Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to find c:out tag from the JSTL library within JSF application

Tags:

jstl

el

jsf-2

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

like image 402
MikeR Avatar asked Dec 21 '22 07:12

MikeR


1 Answers

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:

  • Is it suggested to use h:outputText for everything?
like image 131
BalusC Avatar answered Dec 28 '22 06:12

BalusC