In WriteTag.java // ...... protected int abbreviate = 0; public int getAbbreviate() { return abbreviate; }
public void setAbbreviate(int abbreviate) { this.abbreviate = abbreviate; } // ...... public int doStartTag() throws JspException { // ... if (abbreviate > 0) { output = StringUtils.abbreviate(output, abbreviate); } // Print this property value to our output writer, suitably filtered if (filter) { //... } And the tag: <attribute> <name>abbreviate</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> Then we can use <bean:write name="somename" abbreviate="length"/> for short text we want.