IntelliJ Java IDE
The moose likes Servlets and the fly likes JSP Sessions --> Confused ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "JSP Sessions --> Confused ???" Watch "JSP Sessions --> Confused ???" New topic
Author

JSP Sessions --> Confused ???

mocca az
Ranch Hand

Joined: Mar 07, 2001
Posts: 93
Greetings,
I am not sure what is going on.
Here is the code for 1st JSP sample
session.getSessionId();
<b><%= session %></b>
result for this comes back and it is as follows
session.getSessionId(); org.apache.tomcat.session.StandardSession@401369
however if i do this
<%
session.getSessionId();
%>
<b><%= session %></b>
Tomcat returns
Unable to compile class for JSPE:\Tools\tomcat\work\localhost_8080%2Ftutorials\_0002fimplicitobj_0002ejspimplicitobj_jsp_5.java:58: Method getSessionId() not found in interface javax.servlet.http.HttpSession.
session.getSessionId();
^
I am still beginner and i was looking throught the books, but it doesn't seem i can't figure it out. I mean session is implicit object in JSP so i shouldn't be declaring object variable HttpSession session; and the rest. Some pointers here would be greatly appreciated please. I am using Tomcat 3.2 on Win2K Server.

Mark Savory
Ranch Hand

Joined: Feb 08, 2001
Posts: 122
By having 'session.getSessionId();' without surrounding '<%' and '%>' you just putting the string "session.getSessionId();" into your HTML document that the servlet is creating.
 
 
subject: JSP Sessions --> Confused ???
 
Threads others viewed
problem using logic:iterate
JSTL: remove object from scope
Session.getAttribute() returning null in normal ajax jsp (Oracle Applictaion server portal 10g)
jsp with beans not handling
error when i run a jsp file
developer file tools