I want to use hidden variables for session tracking. How can I get the session object? Since the Servlet API 2.1 there is no method request.getSession ( String sessionId )

reshma deshmukh

In ServletAPI 2.1 a new method is added which is: HttpSession HttpServletRequest.getSession() With which you can get Session object. See http://java.sun.com/products/servlet/2.1/changes.html .

In jsdk 2.1 there are two methods for getting session

1) HttpSession getSession(boolean create) Gets the current valid session associated with this request, if create is false or, if necessary, creates a new session for the request, if create is true.

2)HttpSession getSession() Gets the current valid session associated with this request, if create is false or, if necessary, creates a new session for the request.

[Yes, but that doesn't answer the question -- is there a way to get the session a priori without the server doing it automagically for you? -Alex]

Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact