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

Reply via email to