Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

custom tag reused by container  RSS feed

 
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
Boost this thread!