[jboss-user] [JBoss Seam] - Re: How to truncate output?

christian.bauer@jboss.com do-not-reply at jboss.com
Sun Mar 25 10:02:12 EDT 2007


http://jira.jboss.com/jira/browse/RF-27

Until then:


  | public class WikiUtil {
  | 
  |     public static String truncateString(String string, int length, String appendString) {
  |         if (string.length() <= length) return string;
  |         return string.substring(0, length-1) + appendString;
  |     }
  | }
  | 

wiki-taglib.xml


  | <?xml version="1.0"?>
  | <!DOCTYPE facelet-taglib PUBLIC
  |         "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
  |         "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
  | 
  | <facelet-taglib>
  |     <namespace>http://jboss.com/products/seam/wiki</namespace>
  | 
  |     <function>
  |         <function-name>truncateString</function-name>
  |         <function-class>org.jboss.seam.wiki.util.WikiUtil</function-class>
  |         <function-signature>java.lang.String truncateString(java.lang.String,int,java.lang.String)</function-signature>
  |     </function>
  | 
  | </facelet-taglib>
  | 


  |     xmlns:wiki="http://jboss.com/products/seam/wiki"
  | 
  |     #{wiki:truncateString(aString, 20, '...')}
  | 



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4031391#4031391

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4031391



More information about the jboss-user mailing list