• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Instance variables with Tags

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic