Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP Sessions --> Confused ???

 
mocca az
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By having 'session.getSessionId();' without surrounding '<%' and '%>' you just putting the string "session.getSessionId();" into your HTML document that the servlet is creating.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic