• Post Reply Bookmark Topic Watch Topic
  • New Topic

Instance variables with Tags

 
Rafael Godoi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there!

I have a problem here, related to BodyTagSupport instance variables.

Every time I watch (in Debug) my instance variables at doStartTag() method, my variables are already filled. Shouldn't they be set with the default values (like null, 0, 0.0, etc)?

I know it is dangerous using instance variables with Servlets, but what about Tags?
Edit: By the way, my tag is used many times in the same JSP.

Thank you very much!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As classic tags are re-used on the page, as long as the instance variables represent tag attributes, and that you treat them as hands-off, you should be ok.

You cannot change the values yourself, and you cannot create instance variables that do not represent attributes.

As Simple Tags are not re-sued, they're a bit more forgiving.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!