Help

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

You want chop the last character from a string in EL? Jakarta Commons Lang's StringUtils has a chop() method. There are many other String operations available if you integrate it with your Facelets templates.

You can turn this - and any static method really - into a JSF function with a custom tag lib, e.g. META-INF/custom.taglib.xml:

<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "facelet-taglib_1_0.dtd">
<facelet-taglib>
 <namespace>http://org.apache.commons.lang/StringUtils</namespace>
 <function>
  <function-name>chop</function-name>
  <function-class>org.apache.commons.lang.StringUtils</function-class>
  <function-signature>java.lang.String chop(java.lang.String)</function-signature>
 </function>
</facelet-taglib>

You may need to alter your build.xml to ensure the custom.taglib.xml finds its way to your WAR's META-INF folder.

And use it as such:

value="#{stringutils:chop(keyword)}"

Be sure to bind the stringutils prefix to http://org.apache.commons.lang/StringUtils - add this xmlns attribute to the root element of the page:

xmlns:stringutils="http://org.apache.commons.lang/StringUtils"

(from James Kelly)