Gael Stehagen wrote:
>
> I get a perculiar error, when executing a jsp-page on Tomcat3.1.
> I can't create a session if I try to name it session like this:
>
> <%
> HttpSession session = request.getSession();
> System.out.println("Session Id: " + session.getId();)
> %>
>
> When I access my page from Tomcat, freshly restarted and emptied on all
> caches, I get the message:
> _______
> org.apache.jasper.JasperException: Unable to compile class for
> JSPwork/localhost_8080%2FCIA/_0002findex_0002ejspindex_jsp_138.java:90:
> Variable 'session' is already defined in this method.
> HttpSession session = request.getSession();
"session" is one of the implicit objects (i.e. automatically available) in JSP.
The servlet generated from the JSP page contains code similar to what you
have, so you don't have to do this at all; just use "session" directly. Since
the generated code also uses the variable name "session" you get this
compilation error.
I suggest you read the JSP specification. It describes this plus a lot of
other things you need to know in order to develop JSP pages.
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
===========================================================================
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