Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Session Object in JSP

 
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?
 
Bartender
Posts: 3655
38
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic