Sunday, November 27, 2011

Display partial Strings using OutputText and JSTL

Here is how you can display a substring in JSF using h:outputText and JSTL.

Add the JSTL functions namespace: xmlns:fn="http://java.sun.com/jsp/jstl/functions" to your JSF page.

Use JSTL in the EL Language: #{fn:substring(item.NameOfItem,0,10)} .

That is it!

Thanks.