|Delphi Clinic||C++Builder Gate||Training & Consultancy||Delphi Notes Weblog||Dr.Bob's Webshop|
|JSP Examples and Best Practices|
JSP technology makes it easy to build web pages with dynamic content for the J2EE (Java 2 Enterprise Edition) platform. But as always we can build pages the right way or the wrong way. Sun's J2EE Blueprints are a set of design patterns which can be used for building web applications using JSP. The advantage of the patterns is they are proven and developers can use them to solve common problems. The author uses several patterns for building web applications which gives the reader a good insight in good architectural design.
The intended audience is intermediate or advanced Java/JSP developers, so in the first chapter the author introduces several J2EE patterns, web application structure and different tooling.
The basic structure of a JSP page is explained and at the end of the chapter a small web application is build.
The second chapter covers error pages, form data handling and including of other files in JSP pages.
The third chapter is about separating developer roles using Java Beans.
We learn how to access Java Beans on JSP pages and how to populate data members of the Java Bean with user information.
By using Java Beans we can distinguish between JSP page developers who will access the bean and Java Bean developers who will build the business logic of the application.
In the next chapter we get this role separation by using JSP custom tags.
We learn how we can build custom tags which process body content or are nested within other tags.
Chapter five is about development using patterns. The Model-View-Controller pattern is explained and we build a small web application using this pattern. In the next chapter we are learning about servlet filters to intercept the request and response in and out of our web application. In chapter seven we look at the controller: a servlet which is accessed for every action. The servlet will look at the action and invoke an action helper class to do the business logic. After the business logic is done, the controller will determine which page has to be shown next. The following chapter explains the View Helper pattern using Java Beans and JSP custom tags. Using this pattern we can separate between JSP developers and business logic developers. For example we can make Java Beans which will return static data so the JSP developers can build the pages. Then the real logic can be built and the static data is replaced with the real data. And without changing the JSP pages we can see the real data.
Testing is an important part of building web application (or any application for that matter). In chapter nine we learn how to use the open source JUnit framework for testing. Next we learn how to build our web application archives (WAR) files using Jakarta Ant. Chapter 11 is about application frameworks. All the things we have learned in the previous chapters is put together in an application framework for web applications. The framework presented is still very simple, but it gives us a good head start for building our own framework or for understanding existing application frameworks like Sun' Petstore application and Jakarta Struts. In the final chapter we learn to build a web application using the framework from the previous chapter.
The focus of the book is on good architectural design of J2EE web applications using JSP and not on how to learn JSP syntax. Only the front-end web tier is described and explained. Don't expect anything on Enterprise Java Beans (EJBs) and how to interact with them. Instead normal Java Beans are used to access the database and do business logic. The author takes a step-by-step approach to explain the patterns. We start by building a small application and we extend this application with the learned patterns. After reading the book we get a better idea on how to use different J2EE patterns in our own project. The book makes it also easier to understand other web application frameworks, like Sun's Petstore application and Struts.
(Hubert A. Klein Ikkink)
|More Book Reviews|