EXECUTE: Create JSF2 Kick Start project.
EXECUTE: Replace input.xhtml component by this code:
<?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:composite="http://java.sun.com/jsf/c"> <composite:interface> <composite:attribute name="label"/> <composite:attribute name="value" required="true"/> <composite:attribute name="action" required="true" method-signature="java.lang.String f()"/> <composite:attribute name="submitlabel"/> </composite:interface> <composite:implementation> <h:form> <h:outputText value="#{cc.attrs.label}" /> <h:inputText value="#{cc.attrs.value}" /> <h:commandButton action="#{cc.attrs.action}" value="#{cc.attrs.submitlabel}" /> </h:form> </composite:implementation> </html>
EXECUTE: Ctrl+S
EXECUTE: Open Web Projects View.
ASSERT: input.xhtml is not recognized as a composite component (you can see it the fact that you can't expand this node in the view). It's ok since xmlns:composite="http://java.sun.com/jsf/c" is not a correct name space.
EXECUTE: Then replace input.xhtml component by this code:
<?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http://java.sun.com/jsf/composite"> <c:interface> <c:attribute name="label"/> <c:attribute name="value" required="true"/> <c:attribute name="action" required="true" method-signature="java.lang.String f()"/> <c:attribute name="submitlabel"/> </c:interface> <c:implementation> <h:form> <h:outputText value="#{cc.attrs.label}" /> <h:inputText value="#{cc.attrs.value}" /> <h:commandButton action="#{cc.attrs.action}" value="#{cc.attrs.submitlabel}" /> </h:form> </c:implementation> </html>
EXECUTE: Ctrl+S
EXECUTE: Open Web Projects View.
FAILURE: input.xhtml is not recognized as a composite component (you can see it the fact that you can't expand this node in the view). It's NOT ok since xmlns:c="http://java.sun.com/jsf/composite" is correct.