C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers


10.7k users

0 votes
asked Guru 27.1k points 31 47 92

2 Answers

0 votes
JSTL tags are taghandlers and they are executed during view build time, while JSF UI components are executed during view render time. Note that JSF's own <f:yyy> and <ui:yyy> tags which do not extend UIComponent (i.e. everything except of <f:param> and <f:selectItem(s)> and all those tags having a rendered attribute) are also taghandlers. Also, the id and binding attributes of JSF UI components are evaluated during view build time.

The view build time is that moment when the XHTML/JSP file is to be parsed and converted to a JSF component tree which is then stored as UIViewRoot of the FacesContext. The view render time is that moment when the JSF component tree is about to generate HTML, starting with UIViewRoot#encodeAll(). So: JSF UI components and JSTL tags doesn't run in sync as you'd expect from the coding. You can visualize it as follows: JSTL runs from top to bottom first, producing the JSF component tree, then it's JSF's turn to run from top to bottom again, producing the HTML output. This may lead to unexpected results when using JSTL tags in for example JSF iterating components like <h:dataTable>, <ui:repeat>, etc, or when JSTL tag attributes depend on results of JSF events like preRenderView or submitted form values in the model.
answered Guru 24.6k points 29 51 75
0 votes
As to your concrete functional requirement, if you want to render JSF components conditionally, use the rendered attribute on the JSF HTML component instead.

<h:someComponent rendered="#{lpc.verbose}">


answered Expert 13.2k points 26 40 57

Related questions

0 votes
1 answer 38 views
asked sara Guru 24.6k points 29 51 75
0 votes
1 answer 26 views
asked john Guru 27.1k points 31 47 92
0 votes
1 answer 16 views
asked smith Geek 15.3k points 14 39 58
0 votes
1 answer 83 views
asked smith Geek 15.3k points 14 39 58