Entity Beans

The sample entity bean class is called SavingsAccountBean. As you look through its code, note that it meets the requirements of any entity bean with bean-managed persistence. First of all, it implements the following: EntityBean interface Zero or more ejbCreate and ejbPostCreate methods Finder methods Business methods Home methods In addition, an entity bean class with bean-managed persistence has these requirements:(…)

The SavingsAccountEJB Example

The entity bean illustrated in this section represents a simple bank account. The state of SavingsAccountEJB is stored in the savingsaccount table of a relational database. Thesavingsaccount table is created by the following SQL statement: CREATE TABLE savingsaccount (id VARCHAR(3) CONSTRAINT pk_savingsaccount PRIMARY KEY, firstname VARCHAR(24), lastname VARCHAR(24), balance NUMERIC(10,2)); The SavingsAccountEJB example requires the following code: Entity bean class (SavingsAccountBean) Home(…)

Test Install with Samples

See Verify the Port/SID We provide a set of samples in $ORACLE_HOME/javavm/demo/demo.tar (or for Windows NT). These samples compile and run for a database installed with the Oracle8i Typical install option. Execute these samples as a test of your installation. $ORACLE_HOME/javavm/demo/examples/jsp/helloworld $ORACLE_HOME/javavm/demo/examples/corba/basic/helloworld $ORACLE_HOME/javavm/demo/examples/ejb/basic/helloworld If these samples do not compile or run, your environment is incorrect. Similarly, if these(…)


See Install JDK on the client If your client is a Java client involved with a distributed application–CORBA, EJB, or RMI–you must perform one of the following before compiling your client code: Set up CLASSPATH to include support JAR or ZIP files.  Include support JAR or ZIP files within an option on the compile line. (…)

JDK Setup

1. Install JDK on the Client 2. Set up CLASSPATH 3. Verify the Port/SID 4. Test Install with Samples

The Example Servlets

This chapter uses the Duke’s Bookstore application to illustrate the tasks involved in programming servlets. Table 10-1 lists the servlets that handle each bookstore function. Each programming task is illustrated by one or more servlets. For example, BookDetailsServlet illustrates how to handle HTTP GET requests, BookDetailsServlet and CatalogServlet show how to construct responses, and CatalogServlet illustrates how to track session information.   Table 10-1 Duke’s Bookstore Example Servlets  Function(…)

Tracking Service Requests

Previous : Finalizing a Servlet To track service requests, include in your servlet class a field that counts the number of service methods that are running. The field should have synchronized access methods to increment, decrement, and return its value. public class ShutdownExample extends HttpServlet { private int serviceCounter = 0; … //Access methods for(…)

Session Tracking in Servlets

Previous : Session Management A Web container can use several methods to associate a session with a user, all of which involve passing an identifier between the client and server. The identifier can be maintained on the client as a cookie or the Web component can include the identifier in every URL that is returned(…)

Session Management in Servlets

Previous : Maintaining Client State Since there is no way for an HTTP client to signal that it no longer needs a session, each session has an associated timeout so that its resources can be reclaimed. The timeout period can be accessed with a session’s [get|set]MaxInactiveInterval methods. You can also set the timeout period in deploytool: Select the(…)

Maintaining Client State in Servlets

Previous: Managing Web Context Many applications require a series of requests from a client to be associated with one another. For example, the Duke’s Bookstore application saves the state of a user’s shopping cart across requests. Web-based applications are responsible for maintaining such state, called a session, because the HTTP protocol is stateless. To support applications(…)