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.
Availability: The bean is only available on the current page
Storage: The bean is stored in the PageContext of the current page
Availability: The bean is only available for the current client request
Storage: The bean is stored in the ServletRequest object
Availability:The object is available to all pages during the life of the current HttpSession.
Storage: The bean is stored in HttpSession object
Availability: The bean available to all pages that share the same context.
Storage: The bean is stored in ServletContext object
More from: J2EE
- How to force HTTPS use in a Java Web Application
- JSP useBean and Scope Types
- The Servlet Basic Structure
- Converting Java Object To SOAP Request And Response XML
- Simple EJB2 Architecture [Diagram]
- How to print HttpServletRequest’s All Available Request Parameters and Request Attributes
- Lifecycle of a Java Servlet – three basic phases of initialize, service and destroy
- Complete Tutorial On Using SOAP-UI to Mock Web Service Request / Response