documentation examples changes overview quick start installation command-line configuration admin amber clustering caching database deployment ejb 3.0 embedding filters hessian hmtp ioc jsp logging messaging performance quercus/php remoting scheduled tasks security server push servlets third-party troubleshooting virtual hosting watchdog webapp xml and xslt introduction compilation el jstl directives variables actions applications schema for jsp-2.0 .tld files velocity syntax jsp templates | applications
An application collects servlets, JSP pages, scripts and Java Beans into a self-contained web application. Applications are just generalized virtual hosts, only based on the URL instead of the host name. An application collects servlets, JSP pages, scripts and Java Beans into a self-contained web application. Applications are just generalized virtual hosts, only based on the URL instead of the host name. For example, a bulletin board application groups pages for article reading, group listing, user registration, and new article posting into a single application. Applications can keep track of user sessions, giving the users the illusion of a single application out of disjoint pages.
Many, if not most sites, will only use the default application.
Java Beans get first class treatment in JSP 1.0. Beans can be created for a page, across a session, or for the entire application. The classes and lib directories can contain application beans used by jsp:useBean. These are simply Java classes implementing the bitmechanic work of an application. For example, a shopping cart application may have a set of Java classes that perform the security necessary for credit card processing. The application can put those classes in the beans directory and access them from the JSP page. Beans can be created with different lifetimes.
Requests and pages often last the same lifetime, but may differ if one page forwards or includes another page. Accessing BeansEach bean is defined with a jsp:useBean directive. JSP assigns the created bean object to the JavaScript variable named by jsp:useBean. In addition, the created beans are stored in JSP variables: page
beans are stored in <jsp:useBean id='test' class='java.util.Hashtable'> <% test.put("a", 1); %> <%= test.get("a"); %> <jsp:useBean id='test' class='java.util.Hashtable'> <% var t = request.attributes.test t.put("a", 1); %> <%= test.get("a"); %> 1 Session variables let applications keep track of the user as she moves through the site. Any e-commerce site needs this capability to keep track of the user's purchases. JSP sessions start when the page accesses the session variable. Sessions end when the session times out, when the session is invalidated, or when the application ends.
|