Value expressions still evaluated despite ui:fragment rendered=“false”

前端 未结 1 1428
遥遥无期
遥遥无期 2021-01-29 00:12

I have bean:

class Property{
 private String type;
 private Date value;
 //getters and setters
}

also have block of code on page:



        
相关标签:
1条回答
  • 2021-01-29 00:47

    <ui:fragment rendered> prevents it from rendering the HTML output, but it doesn't prevent it from ending up in JSF component tree and being eligible for state saving.

    Use <c:if test> instead. It runs during view build time instead of view render time and thus the whole bunch won't end up in JSF component tree at all.

    Or, if you have this all inside an <ui:repeat var="property">, and you are using Mojarra, then upgrade to at least 2.1.29 or 2.2.7 wherein this state saving bug was fixed.

    See also:

    • JSTL in JSF2 Facelets... makes sense?
    • PropertyNotFoundException on conditionally rendered subclasses in ui:repeat
    0 讨论(0)
提交回复
热议问题