• Post Reply Bookmark Topic Watch Topic
  • New Topic

Tag reuse by server.  RSS feed

 
Maxim Katcharov
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Would provide a sort of counter upon each refresh. I was under the impression that tags would not keep this information. If I were to set an internal variable with a user's private information, would this mean that the next user may access it? What about optional attributes (are they set to null)? And would these tags ever be used at the same time by two users? (Which would of course be worse than a reuse, as setting all data to null afterwards would not help).

How are tags reused, and what should and shouldn't I worry about?

I'm using Apache Tomcat 5.5.3
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37252
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maxim,
Tags are definitely shared. Any user specific data should go in the HttpSession.
 
Maxim Katcharov
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume that there would be no issue with the same instance of a tag being used at the same time?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the pooled tag instances are never used concurrently. There are 2 things you need to be careful of:

1) Never maintain state in the tag itself -- it can accidentally carry over from one usage to the next.

2) Never ever mess around with the properties set for the tag attributes. The container "owns" these and if you start mucking around with them your day will surely be ruined.

Btw, JSP 2.0 tags that implement the SimpleTag interface are never shared.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!