Home

 

Working with servlets

As described in the Introduction to Java EE Web applications, servlets are flexible and scalable server-side Java components based on the Sun Microsystems Java Servlet API, as defined in the Sun Microsystems Java Servlet Specification. For Java EE Version 5, the supported API is Servlet 2.5, which is used by RAD v7.5.

Servlets generate dynamic content by responding to Web client requests. When an HTTP request is received by the application server, the Web Server determines, based on the request URI, which servlet is responsible for answering that request and forwards the request to that servlet. The servlet then performs its logic and builds the response HTML that is returned back to the Web client, or forwards the control to a JSP.

RAD v7.5 provides the features to make servlets easy to develop and integrate into your Web application. From the Workbench it is possible to develop, debug, and deploy servlets. It is also possible to set breakpoints within servlets, and step through the code in a debugger, and finally any changes made are dynamically folded into the running Web application, without having to restart the server each time.

In the sections that follow, we implement the ListAccounts, UpdateCustomer, AccountDetails, and Logout servlets. Then the command or action pattern is applied in Java to implement the PerformTransaction servlet.

ibm.com/redbooks