This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session problems with JSP on ServletExec, W2000

 
SAFROLE YUTANI
Ranch Hand
Posts: 257
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a very simple JSP page that checks to see if the user is accessing the page from the context of a session and prints a message indicating that a session has been found. But I would think when I access the JSP from a new broswer that the session should not be found, but it is.
HttpSession session = request.getSession( false);
if( session == null){
print(No session found)
else {
print(Found session!)
}
The session should not be found on the first time accessing the page since no session was ever created. Anyone?
thanks
SAF
[This message has been edited by SAFROLE YUTANI (edited November 16, 2001).]
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSP engine will create a session for the JSP. That's why session is one of the implicit objects found in the JSP.
It is in Servlets that the method request.getSession(boolean) is useful.
 
SAFROLE YUTANI
Ranch Hand
Posts: 257
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand that. I know the implicit "session" object exists, but the problem with this is that the JSP will create a new session for you even if the client accesses the JSP without a session. I need explicit control over the session for my application, and I just determined how to do it...
Add this directive to the JSP and the implicit session object disappears...
<%@ page session="false" %>
SAF
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic