[ Team LiB ] |
JSP Implicit ObjectsThe JSP specification makes 9 built-in objects available to the developer. These objects, provided by the Java API without any additional implementation, provide administrative and utility services to the JSP page. These implicit objects are detailed in Table 15.7.
The session object instances of HttpSession (via the HttpServletRequest) are the most commonly used implicit object in JSP page development. Weblogic Server supports JSP sessions according to JSP 1.l. Session objects may be used to store small, short-lived objects within the session. What's a small and short-lived object? You must use your own judgment based upon the performance metrics of your application and the importance of the data. However, large or valuable objects should be stored in a database. This is because JSP sessions are not persisted and there can be a performance bottleneck. For example, you should not store an existing order's line items in a session. They may be lost if the server crashes, and they can take a lot of space, which may slow down the system. However, it's a good idea to store the order in an Entity EJB, and to store the EJB's primary key in the session while it is used. Objects stored in a session make user-defined or other objects available across several resources; that is, objects stored in one JSP page are available to other JSP pages, servlets, and static HTML pages within the same session. If the session data is a user-defined data type, the class should implement the Java Serializable interface. See lines 15 and 22 of Listing 15.3 for an example of session creation and use. The request object is also heavily used in JSP page development. For details on HttpServletRequest and HTTPSession refer to Chapter 14, “Writing WebLogic Server Servlets,” and the JavaSoft documentation site at http://java.sun.com/products/servlet. |
[ Team LiB ] |