JSTL in JSF2 Facelets makes sense?

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 and tags which do not extend UIComponent (i.e. everything except of and 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 , , etc, or when JSTL tag attributes depend on results of JSF events like preRenderView or submitted form values in the model.

As to your concrete functional requirement, if you want to render JSF components conditionally, use the rendered attribute on the JSF HTML component instead.