My immediate thought was you probably will have to, and a Map.clear() would do the job. Then I realised that you'll always be supplying the same dynamic attributes to the tag! For example, if I declare:where both attributes are dynamic, then on each invocation of that handler I'll be replacing the dynamic attributes "dyn1" and "dyn2" by new values, so they'll completely override the existing contents of any storage Map. Although dynamic attributes aren't declared explicitly in the TLD (that's the whole point), they are still statically declared in the JSP page, so they will always be overridden. "Dynamic" is a misnomer here.
I guess the next question is if I have:will those tag instances be re-used together, so will the second tag invocation see the "dyn1" attribute from the first? I think that's probably container dependent, but I would guess not because of the possible problems it would lead to. However, you can always try that in your container and look at the translated JSP code before compilation (on Tomcat, in subdirectories of work/); it should then be easy to see if it reuses the same handler instance or not.
Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / AmazonAmazon UK )
posted 11 years ago
thanks, tomcat does seem to clear the dynamic attributes Map for me, but to be sure I'll do it in doStartTag anyways.
This will take every ounce of my mental strength! All for a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!