<!-- --> is not considered a 'comment' by the compiler (this is true for
Facelets 1.1.x).
Instead, using your example, the entire line is considered an output
component with a value that contains
an expression (i.e. the comment will be passed to the browser).
In order to have the compiler ignore a fragment of the template, use
ui:remove.
On 2/25/10 8:20 AM, webtier_at_javadesktop.org wrote:
> Hi,
>
> I have a page that looks roughly like the following:
>
> [code]
> <?xml version='1.0' encoding='UTF-8' ?>
> <!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:f="http://java.sun.com/jsf/core">
> <h:head>
> <title>Main</title>
> </h:head>
> <h:body>
> <h:form prependId="false">
> <!--h:commandLink action="#{someBackingBean.logout}" value="logout" /-->
> </h:form>
> </h:body>
> </html>
> [/code]
>
> I know the page is useless but I intentionally created it like this, so as not to clutter the example.
>
> Please, pay attention to the fact that the EL expression is in a section that's commented out. So, it should not be evaluated.
>
> When I try to display the page, however, I get an exception:
>
> [code]
> An Error Occurred:
> The class 'com.testapp.web.SomeBackingBean_$$_javassist_55' does not have the property 'logout'.
>
> javax.el.PropertyNotFoundException: The class 'com.testapp.web.SomeBackingBean_$$_javassist_55' does not have the property 'logout'.
> at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:661)
> at javax.el.BeanELResolver.getValue(BeanELResolver.java:290)
> at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
> at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
> at com.sun.el.parser.AstValue.getValue(AstValue.java:116)
> at com.sun.el.parser.AstValue.getValue(AstValue.java:163)
> at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
> at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:71)
> at com.sun.faces.facelets.el.ELText$ELTextVariable.toString(ELText.java:207)
> at com.sun.faces.facelets.el.ELText$ELTextComposite.toString(ELText.java:148)
> at com.sun.faces.facelets.compiler.CommentInstruction.write(CommentInstruction.java:70)
> at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:75)
> at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:176)
> at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
> at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
> at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)
> at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
> at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
> at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:380)
> at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
> at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)
> at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
> at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
> at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
> at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
> at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
> at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
> at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
> at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
> at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
> at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
> at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
> at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
> at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
> at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
> at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
> at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
> at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
> at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
> at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
> at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
> at java.lang.Thread.run(Thread.java:619)
> [/code]
>
>
> So, why does JSF attempt to evaluate EL expressions that are in comments?
>
> Furthermore, the backing bean DOES have a logout method. And if I uncomment the code, it works. No exceptions. The property exists.
> [Message sent by forum member 'vesuvius' (vesuvius_prime_at_hotmail.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=388713
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>