• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Object in JSP

 
sumit Sanghai
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) How can we get a current session object in a JSP page other than using the method reequest.getSession?

2) Is config object available implicitly in a JSP page in all the versions of JSP?
 
Mikalai Zaikin
Ranch Hand
Posts: 3371
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sumit Sanghai:
1) How can we get a current session object in a JSP page other than using the method reequest.getSession?


The 'session' object.

An object of type javax.servlet.http.HttpSession.

This is the HttpSession object associated with the request. Sessions are created automatically, so this variable is bound even if there was no incoming session reference. The one exception is if you use the session attribute of the page directive to turn sessions off, in which case attempts to reference the session variable cause errors at the time the JSP page is translated into a servlet.

The session object created for the requesting client (if any). This variable is only valid for HTTP protocols. Has a session scope.



2) Is config object available implicitly in a JSP page in all the versions of JSP?


The 'config' object.

An object of type javax.servlet.ServletConfig.

The ServletConfig for this JSP page. Has a page scope.

The 'config' object exists both in JSP 1.2 and JSP 2.0.

More details : http://java.boot.by/wcd-guide/ch06s05.html

regards,
MZ
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic