Mantis - Resin
Viewing Issue Advanced Details
2029 minor always 09-26-07 07:12 09-26-07 07:19
sam  
ferg  
urgent  
closed 3.1.2  
no change required  
none    
none  
0002029: attribute setter is not called for tag if the value has not changed
(rep by T Fukuda)

The s2struts package contains a LinkTag that changes to value of an internal member variable that corresponds to an attribute within the doStartTag.

Resin does not call the setter unless that value has changed.

For example, the following does not work:

public class SampleTag extends BodyTagSupport {

    private String name = null;

    public void setName(String name) {
        this.name = name;
    }

    public int doStartTag() throws JspException {

        try {
            JspWriter writer = pageContext.getOut();
            writer.write(this.name);
        } catch (IOException e) {
            throw new JspException(e);
        }

        this.name = "---";

        return EVAL_BODY_BUFFERED;
    }
}

<%
for (int i = 0; i < 3; i++) {
%>
  <f:bar name="<%= "value" + i %>" />

<%
}
%>

<%
for (int i = 0; i < 3; i++) {
%>
  <f:bar name="aaa" />

<%
}
%>

value0
value1
value2
aaa
---
---

https://www.seasar.org/svn/s2struts/trunk/s2struts/src/main/java/org/seasar/struts/taglib/html/LinkTag.java [^]

Notes
(0002313)
sam   
09-26-07 07:16   
Resins behaviour is conformant with the specification.

The JSP 2.1 spec states:

"Once properly set, all properties are expected to be persistent, so that if the JSP container ascertains that a property has already been set on a given tag handler instance, it must not set it again."

and

"If a tag handler is used for more than one occurence, the container must reset all attributes where the values differ between the custom action occurrences. Attributes with the same value in all occurrences must not be reset. If an attribute value is set as a request-time attribute value (using a scripting or an EL expression), the container must reset the attribute between all reuses of the tag handler instance."
(0002314)
ferg   
09-26-07 07:18   
Resin's behavior is correct.

To work around buggy tag libraries, you can use

  <jsp recycle-tags="false"/>