The beans can be declared in JSP as following:
<jsp:useBean id=”name” class=”mypackage.MyClass” scope=”request”/>
Scope parameter indicates the context in which the bean should be made available. There are four different possible kinds of useBean scope, “page” scope being the default one.
“page”
Availability: The bean is only available on the current page
Storage: The bean is stored in the PageContext of the current page
“request”
Availability: The bean is only available for the current client request
Storage: The bean is stored in the ServletRequest object
“session”
Availability:The object is available to all pages during the life of the current HttpSession.
Storage: The bean is stored in HttpSession object
“application”
Availability: The bean available to all pages that share the same context.
Storage: The bean is stored in ServletContext object
Originally posted 2008-08-10 18:52:20.