4

I am building out a dynamic table using JSTL and was hoping to make use of the c:out tag to help build out some expressions, but am not able to find that tag available among the other JSTL core tags.

I have the following namespace being used:

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

and made sure my web.xml file was set to use the 2.5 spec found here https://stackoverflow.com/tags/jstl/info

but still only find catch, choose, forEach, if, otherwise, set, and when.

Additionally, I tried importing the JSTL 1.2.1.jar libraries as well with no success.

So, should the c:out tag be available for me to use in JSF2 ? If so, what steps am I missing?

Regards,

Mike

Community
  • 1
  • 1
MikeR
  • 633
  • 8
  • 21

1 Answers1

11

The <c:out> indeed not available in JSF2 Facelets. You don't need it in JSF2 Facelets anyway. Just use the JSF equivalent <h:outputText>,

<h:outputText value="#{bean.text}" />

or even better, just put EL in template text,

#{bean.text}

It will already be implicitly XML-escaped if that's your sole concern (and was during old JSP2 ages actually the sole reason why <c:out> is been used; in JSP1 the tag was simply mandatory in order to display a bean property as EL in template text wasn't supported in JSP1). The <c:out> offers no additional advantages over those standard JSF2 Facelets ways, that's why it's been removed from the JSTL subset for Facelets.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • 1
    if people do need to render the HTML within the variable in the same way c:out escapeXml="false" is used, then use escape="false". I came across this thread when I got Tag Library supports ... but no tag was defined for name: out – Tom Chamberlain Jun 01 '15 at 14:58