Ashwani Kalra wrote:
>
> Hi all
> One basic question. What is the scope the variable that are declared using
> <%! %> tags when that page is compiled into servelet. Is it private, public
> , protected.can some other servelet or jsp access those variables.

That's all up to you. Whatever you put within <%! %> ends up in the generated
servlet code at the top level scope, so if you want a private variable
declaration, use:

  <%! private int foo; %>

But are you sure you really want to use this mechanism? Using instance variables
declared this way causes the same kind of multi-threading problems as using
instance variables in a regular servlet. I suggest you try to find another way
to solve the problem, for instance saving state as objects in the session or
application scopes.

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to