Runtime components : Presentation components : JSPs : Tasks : Using session scope
  
Using session scope
When cookies are enabled to allow HttpSession support at the Web application server, JSP 1.0 makes the predeclared variable session available for use in JSP code. This variable is set automatically by the toolkit to the same session that is made available to toolkit operations; so both JSP code and operations can share data from the session-scoped data area.
When using a JSP bean, set the useBean tag attribute scope value to one of the possible options (application, page, request or session). When given a session scope, a JSP bean can be loaded at the start of the session and reused for the life of the session. Following is an example:
<jsp:useBean id="myBean" scope="session" class="MyClass">
The JspContextServices bean would usually be defined with a page or request scope, since it requires a more frequently refreshed initialization. See transfer.jsp in the HTML Sample Application for an example.
Go up to
Tasks