Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Invalid
-
2.2.8
-
None
-
None
-
Windows, JSF 2.2, Weld CDI 2.2.16.Final, Eclipse Mars, OmniFaces 2.1
Description
When dynamically adding a composite control to a page, any custom FacesComponent in the composite control can't access its properties.
(BTW, I found this issue in MyFaces 2.2.8, but both scenarios below work fine in Mojarra 2.2)
(Also, the issue occurs early on postback in MyFaces framework so I'm not seeing any errors in logs, other than in the HTTP response and the exception it shows on the web page. I can breakpoint on the FacesComponent instantiation, but nowhere else do I get control.)
-
-
-
-
-
-
- This works *******
Enter value, hit Refresh button.
[ Note: This has the CustComp FacesComponent statically on the page.
Also note: xmlns:cvc="http://java.sun.com/jsf/composite/com/aadhoc/cvc/spikes/extensionsapproach/components"]
- This works *******
-
-
-
-
-
<h:form id="modelerForm">
<h:commandButton value="Refresh" type="submit"/>
<h:outputText value="CustProp:"/>
<cvc:CustComp/>
</h:form>
-
-
-
-
-
-
- This breaks *******
Hit Add button, then hit Refresh button.
[Note: This dynamically adds a CompTestChild composite, which contains the CustComp FacesComponent]
<h:form id="modelerForm">
<h:commandButton value="Refresh" type="submit"/>
<h:commandButton value="Add" actionListener="# {modelerController.compTestOnAdd}"/>
<cvc:CustComp/>
<h1>Controls</h1>
<h:panelGrid id="controlsPanel"/>
</h:form>
- This breaks *******
-
-
-
-
-
Error:
javax.el.PropertyNotFoundException: Property 'prop' not found on type javax.faces.component.UINamingContainer
viewId=/modeler.xhtml
location=M:\home\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\CVC Spike Extensions Approach\modeler.xhtml
phaseId=PROCESS_VALIDATIONS(3)
Caused by:
javax.el.PropertyNotFoundException - Property 'prop' not found on type javax.faces.component.UINamingContainer
at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:268)
/resources/com/aadhoc/cvc/spikes/extensionsapproach/components/CustComp.xhtml at line 20 and column 36 value="#
{cc.prop}"This is my custom FacesComponent (CustComp.xhtml):
<?xml version="1.0" encoding="ISO-8859-1" ?>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:h="http://java.sun.com/jsf/html"
>
<cc:interface componentType="com.aadhoc.cvc.spikes.extensionsapproach.CustComp">
</cc:interface>
<cc:implementation>
<h:outputText value="Prop:"/>
<h:inputText value="#{cc.prop}
"/>
</cc:implementation>
</html>
Backing:
@FacesComponent(value = "com.aadhoc.cvc.spikes.extensionsapproach.CustComp", createTag = false)
public class CustComp extends UIInput implements NamingContainer {
private String prop;
public CustComp() {
}
public String getProp()
public void setProp(String prop)
{ this.prop = prop; } @Override
public String getFamily()
}
modelerController:
public void compTestOnAdd()
CompTestChild.xhtml:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:cvc="http://java.sun.com/jsf/composite/com/aadhoc/cvc/spikes/extensionsapproach/components"
>
<cc:interface>
</cc:interface>
<cc:implementation>
<h:panelGrid columns="2">
<h:outputText value="CustProp:"/>
<cvc:CustComp/>
</h:panelGrid>
</cc:implementation>
</html>
web.xml includes:
<resource-env-ref>
<!-- Enable Weld CDI, also needs META-INF/context.xml entry -->
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
</resource-env-ref>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME</param-name>
<param-value>true</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>