Skip to main content
main-content

Inhaltsverzeichnis

Frontmatter

Servlets

Frontmatter

Chapter 1. Servlet Theory

Whenever a simple idea is elegant and powerful enough that its applications open development paths that were previously closed, the architects of that idea might truly feel their work has been a benefit to the development community. A servlet represents an idea that falls into that category, vaguely bringing back memories of the old Othello game slogan, “A minute to learn, a lifetime to master.”
Lennart Jörelid

Chapter 2. Sharing Servlet Resources

A Web server may include an application’s output in its response to a calling client browser. The application and the included result are termed server-side include (SSI). The reasons for using SSI applications are identical to those of using a servlet in a Web server; you can use SSI when the resulting output should include dynamically generated output, such as the current time or a dynamically generated image.
Lennart Jörelid

Chapter 3. Servlet Examples

When investigating a new technology, concise examples are often helpful. Taking a look at working and carefully crafted example code maybe the only help you need, other than a brief overview and the application programming interface (API) documentation. This chapter covers three servlet examples:
  • Shopping cart servlet
  • Firewall HTTP tunnel to an interactive application (in other words, interacting with an application behind a firewall using HTTP tunneling)
  • Binary document uploader servlet transporting a document from the client’s computer to the server
Lennart Jörelid

JSP

Frontmatter

Chapter 4. JavaServer Pages

Servlet technology may be efficient, scaleable, platform independent, and buzzword compliant—but it is far from practical when building Web applications. Servlets can become too inflexible to survive in the dynamic environment of a Web application when intimately tied to or used in generating the user interface. JavaServer Pages—JSPs for short—is a way to counter the shortcomings of servlets and bring the technology up to speed with the development process of most modern Web applications.
Lennart Jörelid

Chapter 5. JSP Tag Libraries

The term tag is ci, to markup languages such as HTML and XML. A markup document grants meaning to text by surrounding or preceding it with a set of characters collectively called a tag. In HTML and XML documents, tags have the form <text> where text defines the meaning of the tag. For instance, a HTML first-level header maybe created simply by surrounding the text with header tags: (<h1>This is a first-level header</h1>). JSP technology provides a standard mechanism whereby a programmer can create his/her own server-side tags. These JSP tags are evaluated on the server, and their results are sent back to the client browser.
Lennart Jörelid

Chapter 6. JSP Examples

The more abstract a technology gets, the more difficult it can be to determine its usefulness. In many cases, however, using a particular set of Java APIs simply requires understanding the order and name of the life-cycle methods to invoke.
Lennart Jörelid

Struts

Frontmatter

Chapter 7. The Apache Struts Framework Walkthrough

System architecture is a topic much debated when building Web application systems; most J2EE architects and developers have their own household rules, frequently collected over a series of development projects. Every customer stresses that it is important to plan ahead, develop for reusability, create a robust system that will withstand changes of requirements and specifications—and, of course, be buzzword compliant.
Lennart Jörelid

EJB

Frontmatter

Chapter 8. Integrating with the Business Tier

All view and controller servlets and JSP documents require some form of support from business entities; data that should be presented in the view tends to be a controlled and limited version of the corporate business database. In the case of a financial institution such as a bank, a normal view could be the account balance of a logged-in customer. Very few systems generate such business data solely in the Web application; the majority of Web applications present data read from enterprise information systems (EIS) and laundered in a business logic tier. Most industrial-grade Web applications are designed according to the J2EE paradigm; they therefore require support from both enterprise JavaBeans (EJB)—which contain the business logic—and from large databases that constitute the EIS tier.
Lennart Jörelid

Chapter 9. Example 1: Centralizing Exchange Rates

In the J2EE programming paradigm, Enterprise JavaBeans are the glue that binds the server front end with its back end. The “front end” of a server is the part that receives all commands from the user and, after all processing of a command is done, and sends the results back to the user. The “back end” of a server is the part where all data is collected to business and aggregate objects, according to the instructions of the user for the particular task. The back end also hides various complexities that are associated with moving data to and from legacy data sources. Chapters 9 through 11 demonstrate three different scenarios where EJBs are used:
  • Chapter 9: Direct Java application interaction with the EJB tier using a stateless session ETB server
  • Chapter 10: Migrating a Web application from old-style servlet-to-database interaction to session EJB proxy operation.
  • Chapter 11: Continue migration to include aggregate value objects and back-end tier abstraction using Entity EJBs.
Lennart Jörelid

Chapter 10. Example 2: Refactoring an Old-Style Web Application

This EJB example illustrates a fairly common problem: migrating a Web application from old-style servlet-to-database interaction to session EJB proxy operation. This problem, or something quite similar, is frequently encountered by developers who are required to update a first-generation Web application to a more modern architecture.
Lennart Jörelid

Chapter 11. Example 3: Entity EJBs for Database Integration

The database back end we developed in the first refactoring step of the old-style Web application introduced in Chapter 10 is fine for selecting data from the database back end. However, should we wish to modify or update the database content, that refactoring model can be augmented to simplify data alteration and increase flexibility.
Lennart Jörelid

Backmatter

Weitere Informationen