B
Big Slim
Okay, I'm sure this has been asked here before, but here goes. I have a
custom tag with one instance variable, a String named "page."
A couple of JSPs use this same tag, but depending on which page uses
it, the "page" variable may be different. In the doEnd() method, the
tag tests the value of the "page" variable and does different things
depending on which page calls it.
Is this custom tag thread-safe? It would appear that it is not, since
any thread could come along and change the value of "page" at any time.
A Java programmer I know said it is okay as long as I let the tag "fall
out of scope."
I'm not sure what he meant by that. I am not saving the tag in any
scope, so I assume he means this instance of the tag will be garbage
collected after the request has been processed (similar to an object
created with the "new" constructor).
However, I'm in doubt. Isn't only one instance of a custom tag created
for all threads to access?
Help!--Big Slim
custom tag with one instance variable, a String named "page."
A couple of JSPs use this same tag, but depending on which page uses
it, the "page" variable may be different. In the doEnd() method, the
tag tests the value of the "page" variable and does different things
depending on which page calls it.
Is this custom tag thread-safe? It would appear that it is not, since
any thread could come along and change the value of "page" at any time.
A Java programmer I know said it is okay as long as I let the tag "fall
out of scope."
I'm not sure what he meant by that. I am not saving the tag in any
scope, so I assume he means this instance of the tag will be garbage
collected after the request has been processed (similar to an object
created with the "new" constructor).
However, I'm in doubt. Isn't only one instance of a custom tag created
for all threads to access?
Help!--Big Slim