JSP tag lifecycle
        Posted  
        
            by mkoryak
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by mkoryak
        
        
        
        Published on 2009-03-05T18:46:12Z
        Indexed on 
            2010/05/18
            12:00 UTC
        
        
        Read the original article
        Hit count: 539
        
i just introduced a bug into my code because i seem to have misunderstood the jsp tag lifecycle. The tag worked like this before the bug: i pass the tag some collection as an attribute, and it displays it as a table. The collection was passed into the JSP from the controller.
after the bug: a removed the attribute which set the collection. instead, in the tag i check if the collection is null, and then grab it by name from the request (using a naming convention).
the thing that i didnt expect: after the collection was initially set in the tag, it would never become null on subsequent executions! it was still defined as an non-requred attribute in the TLD.
I expected the tag to not hold on to previous values between executions.
© Stack Overflow or respective owner