This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

custom tag reused by container

 
Esteban Puertas
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!,
I have some questions regarding classic tags.
Can someone tell me please if the specification dictates that clasic tag handlers are always cached by the container?
I think this can be some source of portability problems when running the tags under different application servers if some of them reuse the tag instance and others don't do that.
It is a bad practice to use instance variables inside a classic tag handler?

Thank you for any reply :-)
 
Ash More'
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, the specification does mention about the reuse of classic custom tags whereas for simple tags and tag files, new instances are created on every invocation.
its a good idea to reinitialize the values of instance variables after your custom tag finishes its work. say you have some instance variables in your custom tag as: String s and int i. So in the body of doEndTag, just before it returns EVAL_PAGE or SKIP_PAGE, type s="" and i=0. Dont rely on any specific containers behaviour if you want portability.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic