Delphi Clinic C++Builder Gate Training & Consultancy Delphi Notes Weblog Dr.Bob's Webshop
Hubert Klein Ikkink (aka Mr.Haki) - Communications Officer Dr.Bob's Kylix Kicks Delphi in a Nutshell
 Book Review: JavaServer Pages
See Also: Dr.Bob's Programming Books for Delphi & C++Builder books co-authored by Bob Swart
JavaServer Pages
Hans Bergsten
552 pages (no CD-ROM)

I always disliked JavaServer Pages technology, because it didn't support clean coding. Java code embedded with HTML code doesn't support reuse of code or it must be the copy-paste method of reuse. But with the JSP 1.1 version things have changed. We can now write custom tags, which are basically reusable Java components. We can build complete libraries with custom tags, which can be used again and again in our web applications. But it was always difficult to find a good book which would be almost dedicated to this standard. Most JSP books will focus on JSP 1.0, with a lot of Java code embedded in HTML. The book JavaServer Pages, which is described in this review, is the opposite. The main focus is on custom tags and JSP 1.1, which is a good thing I think.

In the first chapters we are introduced to JSP, servlet and HTTP basics. How the request and response mechanism works is explained and in chapter three we see a brief overview of the Model-View-Controller architecture for web applications. The MVC model will be used throughout the book, so we can learn how to build web applications correctly. Finally the introductionary chapters are concluded with a chapter on how to install the TomCat JSP/servlet engine and how to install the downloadable samples.

The second part of the book focuses on JSP application development. The first chapter of this part uses JavaBeans and JSP tags to display dynamically generated information on a web page. The following chapter is about using Java control structures and statements in the page. And we see how we can handle HTML form posts and dynamically checking HTML form input elements. In chapter 7 the author writes about error handling and debugging. We need to have some kind of mechanism in place in our web application, which will handle errors correctly. And because a JavaServer page is compiled during runtime we have to deal with syntax errors. The author describes a JavaBean for displaying the contents of a request, cookies and the like in a page. Using this bean we can more easily debug a page.

A web application consists of a set of pages, which will interact which each other. Data must be passed between pages and over several pages. We can use different objects to achieve this, like PageContext, Session and Request. The author describes clearly how to use these objects for data sharing. In this chapter we also have the first mention and reference of custom tags. From now on in the book custom tags are used for the examples. We learn for example about a custom tag with loop behaviour for different types of objects. A downside is the fact we can not see the Java source of these custom tags in the book. We need to download the examples from the web site to see the Java source. The following chapter is all about accessing databases. In most web applications the data is dynamically generated from a database. The author introduces different custom tags to access databases. Authentication and security are covered in the next chapter. Useful examples on how to authenticate users, check user's sessions and more are described by the author. Internationalization issues are the topic of the next chapter. The world wide web is of course an international affair. We must support different country settings for example by displaying text in the user's language. Also handling localized input is handled. The last chapter of this part of the books contains different little subjects like XML and JSP, precompiling and more.

The last part of the book is about JSP with other server-side technologies like Java servlets and Enterprise JavaBeans. First the Java 2 Enterprise Edition (J2EE) application model is explained. Next JSP interacting with servlets is covered. Servlets are used for the processing of data and implementing business logic. A JavaServer page is used for displaying the data. Also a application model is explained which is build using a modular design with different JavaBeans. The next chapter is about JavaBeans and how to build them to be used in combination with JSP. This chapter is followed by a chapter about custom tags and how to write such custom actions ourselves. The different classes available in the servlet API are introduced and explained. We learn to write custom actions with and without a body, with and without body text processing. The last chapter is about creating generic and reusable custom actions for accessing a database.

The book concludes with five appendixes, with a JSP API reference, JSP syntax reference, API reference of the book's examples, JSP resource and reference to the web-application structure and deployment descriptor.

I specifically like the focus on JSP 1.1 and custom tags in this book. The author encourages the reader to write reusable and maintainable web applications using JavaServer Pages technology. And has proved a good reference to me for writing custom actions myself.

(Hubert A. Klein Ikkink)

More Book Reviews

This webpage © 2001 by webmaster drs. Robert E. Swart (aka Dr.Bob - All Rights Reserved