• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

dynamic attributes and classic tags

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As classic tags are re-used by the container is it required to clear the map of dynamic attributes as part of initiliaing class members in doStartTag?

thanks

Stu
 
Author
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stu Johns
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks,
tomcat does seem to clear the dynamic attributes Map for me, but to be sure I'll do it in doStartTag anyways.

Stu
 
This will take every ounce of my mental strength! All for a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic