-
15. Re: protect jsf files
javatwo Dec 13, 2010 12:07 AM (in response to javatwo)Different from JSP, facelet tries to evaluate value binding even if component is not rendered.
<h:dataList var="bean" ... >
<h:outputText value="#{bean.title} #{bean.name}" rendered="#{bean.professor}" />
<h:outputText value="#{bean.name}" rendered="#{bean.student}" />
</h:dataList>
javax.el.ELException: /person.xhtml: Property 'title' not found on type mypackage.Student
at com.sun.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:53)
at com.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:39)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:232)
at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:106)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:234)----------------
The title has getter only, no setter.
When bean is a student, #{bean.professor} is false, so #{bean.title} should not be evaluated as JSP does.
Is there a way to work around this? Thanks for help.
Dave
-
16. Re: protect jsf files
nbelaevski Dec 13, 2010 5:53 AM (in response to javatwo)Check whether you have #{bean.title} specified outside components.
-
17. Re: protect jsf files
javatwo Dec 13, 2010 10:46 AM (in response to nbelaevski)I put <ui.fragment rendered="#{bean.professor}"> around, the problem solved.
Now I get another error:
<t:dataList var="car"
value="#{storeBean.carList}" >
<f:subview>
<ui:include src="/detail.xhtml" >
<ui:param name="bean" value="#{car}" />
</ui:include>
</f:subview></t:dataList>
javax.el.PropertyNotFoundException: Target Unreachable, identifier 'bean' resolved to null
the initial page is rendered correctly by GET method, But when clicking a command button inside the /detail.xhtml, I got the error above.
From debug, the storeBean.getCarList() returned 2 cars during render phase, the command did not change the carList as expected. but the bean resolved to null in the dataList during render phase. JSP version worked without error.
Thanks for help.
Dave
-
18. protect jsf files
javatwo Feb 1, 2011 7:21 AM (in response to javatwo)I like to create a bug for this, but could not find its issue tracker website. Anyone knows where is the issue tracker for facelet?
Thanks,
Dave -
-
20. Re: protect jsf files
henk53 Feb 26, 2011 9:27 AM (in response to javatwo)This is maybe not the place to discuss this, but you are mixing up component tree building and run time processing of components. In JSF, some tags help to create the tree, others become components. Components can be run-time evaluated by e.g. the dataList, but those helper tags just disappear.
I suggest posting a question on a site more suited to this kind of problem, like stackoverflow. Explain what you are trying to achieve and show both your JSP and Facelets versions.