Bug 19422

Summary: Changing beanId from "" to null makes input tags non-reusable.
Product: Taglibs Reporter: Ari Savolainen <ari.savolainen>
Component: Input TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 1.1   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Ari Savolainen 2003-04-29 10:50:06 UTC
In the following jsp-fragment the bean is used in the latter <input:text> in
spite of attribute bean="" in some JSP containers. This is because the beanId
field of the input tags is changed to null if it was originally "". (There is a
workaround: give an arbitrary value to the bean attribute. The workaround causes
some unnecessary method calls.)

<%
    Map map = new HashMap();
    map.put("foo", "bar");
    pageContext.setAttribute("map", map);
%>
<html>
    <head>
        <title>Test</title>
    </head>
    <body>
        <input:form bean="map" method="post" >
            <input:text name="foo" bean="" /><br />
            <input:text name="foo" bean="" />
        </input:form>
    </body>
</html>

A fragment from the JSP specification 1.2 (from chapter Tag Extension API -
JSP.10.1 - Simple Tag Handlers - Properties):

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 needs not set it again.
Comment 1 Karl von Randow 2004-10-26 22:26:44 UTC
Fixed with the change to a local variable for beanId changes and addition of 
release() methods.
Comment 2 Karl von Randow 2004-10-26 22:27:42 UTC
Fixed with change to using use a local beanId variable and addition of release
() method.