Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Classic Tag please help?

 
hasan khan
Ranch Hand
Posts: 223
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have create 1 Classic Tag Handler EncodeURL1 for encoding urls with session ID and encoding param name/value with URLEncoder.

i am using prop intance varible of type Properties class for storing param name & value.

i am initializing prop in the contructor.

As instance of Classic Tag Handler are reused by the Container.

please tell me where do i clear prop. instance so it does not get accumulate.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you wrote should be fine.
 
hasan khan
Ranch Hand
Posts: 223
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
will that be fine in Multi-threaded call to the tag ?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) The container won't share a single instance of a tag class at the same time. There's no multithreading issue there.

2) The final event in a tag's lifecycle is the release() method, where the spec guarantees that all properties are reset to an initial value by the container. So if the tag gets reused, you should not have to worry about class-level variables getting carried over or shared.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic