but wouldn't that cause data corruption since the variable is an Instance
class variable and all threads could access it, possibly at the same time.
You would have to synchronized all methods that used the vars.
Marc
-----Original Message-----
From: Jim Bailey [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 20 June 2000 3:41 AM
To: [EMAIL PROTECTED]
Subject: Re: runat="server"?
As far as I can tell, the first example shouldn't be valid. It should create
a syntax error: "illegal modifier on local variable" or something like that.
The second example is valid on JSP 0.91 and Websphere 2.0x for sure but I
don't know how "standard" it is. It puts the variable myInt as a class
static variable on the servlet generated from the .JSP file. It is
equivalent to the following:
public class _int_test__jsp extends HttpServlet
{
private static final int myInt = 0;
public void
_jspService(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{... etc
}
-----Original Message-----
From: Marc Krisjanous [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 19, 2000 4:03 AM
Hi all,
what is the difference in declaring variables using in JSP verion .91???
I use this and it works find:
<%private static final int myInt = 0; %> and
But I have seen some code that uses this:
<SCRIPT runat="server">
private static final int myInt = 0;
</SCRIPT>
Cheers
Marc
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets