1
votes

we are going to migrate our JSF 1.2 project to JSF 2. We are already using facelets (not JSPs) as our presentation technology.

We are using lot of JSTL -> "xmlns:c="http://java.sun.com/jstl/core"

We are using lot of <c:if> statements. I know that JSF2 brings rendered attribute, which should also evaluate boolean expressions.

Should I bother rewriting stuff to new rendered attribute or is it ok to continue using JSTL in JSF2?

1

1 Answers

1
votes

JSTL works the same way in JSF2 as it worked in JSF1. The rendered attribute is not JSF2 specific, it has been in JSF all the lifetime long. If those JSTL tags have always worked as intended in your JSF 1.2 application, then you don't necessarily need to migrate them for JSF2. You only need to change the taglib uri to include the /jsp (!!) path.

xmlns:c="http://java.sun.com/jsp/jstl/core"

However, whenever possible, using the rendered attribute definitely is more recommended than relying on JSTL tags. For sure if you plan to bind JSTL tag attributes to a @ViewScoped bean. See also Communication in JSF 2.0 - @ViewScoped fails in taghandlers.