struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <trunca...@gmail.com>
Subject Should an attribute add to <bean:write/> tag?
Date Tue, 10 Jan 2006 01:44:40 GMT
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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message