What’s new in the second edition?

I already have the first edition of your book. What am I missing if I don’t buy the new, second edition?
Answer:
The second edition is a major update of pretty much all chapters and also includes some new chapters. Here’s what one reader says about the second edition on Amazon.com:

Many new editions of technical books I have purchased have not entirely been worth the purchase price. Usually the updated material is limited in scope or fairly light. The new edition of this book is definitely worth it.[…]

Overall, I consider this book, especially this edition, an absolute must have in my professional bookshelf.

And here’s an excerpt from the Preface that describes the differences compared to the first edition:

Readers of the First EditionIf you’ve read JavaServer Pages, 1st Edition, you will first of all notice that in this edition, most of the custom components have been replaced in favor of the equivalent standard components from JSTL; a specification I’ve been lucky enough to contribute to and help shape the standard based on many of the ideas explored in the first edition. Secondly, you’ll notice that all chapters have been substantially improved and extended, and that new chapters have been added to highlight important features such as custom actions and JavaBeans, explain how to process XML data, and how to integrate your custom components with the standard JSTL components.

All chapters have also been updated to cover the features and clarifications added in the JSP 1.2 and Servlet 2.3 (which JSP 1.2 is based on) specifications, primarily:

  • New XML syntax for JSP pages.
  • New listener and filter component types.
  • New tag library validator.
  • New options for tag library deployment and distribution.
  • New tag handler interfaces and return values.
  • New tag library descriptor elements to minimize the need for TagExtraInfo classes
  • Improved support for pages stored in other encodings than ISO-8859-1.
  • Improved rules and a new mechanism for attribute value conversion.
  • Improvements to the include action.
  • Clarifications of the reuse of tag handler instances and their lifecycle.
  • Alignment of the tag library descriptor elements with the elements in other J2EE descriptors.

JavaServer Pages, 2nd edition released

The second edition of JavaServer Pages, (O’Reilly) was released this week and is now available for purchase in most book stores and online book web-stores.

The second edition is completely revised to cover JSP 1.2 and the JSP Standard Tag Library (JSTL) 1.0 specification.

JSP 1.2 article at ONJava.com

The JSP 1.2 specification was released on September 17, along with the Reference Implementation for the new specification: Tomcat 4.0.

Part 2 of an article where I describe the new JSP 1.2 features is now available on the ONJava.com site. If you like to run the book examples with Tomcat 4.0, see this tip for some pointers.

Can I run the examples from the first edition with Tomcat 4.0?

I know that the JSP 1.2 specification is now final, and that Tomcat 4.0 implements the new specification. Is there anything special I need to do to run your JSP 1.1 example application from the first edition of the book with Tomcat 4.0?
Answer:
JSP 1.2 is backwards compatible with the JSP 1.1 specification, so any JSP 1.1 application should run unchanged with a JSP 1.2 compliant container. Besides Tomcat 4.0, other containers also implement the new Servlet 2.3 and JSP 1.2 specifications.You install Tomcat 4.0 pretty much the same way as described for Tomcat 3.2 in the book. The only difference is that you should set the CATALINA_HOME environment variable instead of the TOMCAT_HOME variable. This name change refects the fact that the servlet container part is actually called Catalina, while the JSP part is called Jasper: combined they are called Tomcat.You start and shut down Tomcat 4.0 just as Tomcat 3.2, using the startup and shutdown scripts in the bin directory.

Tomcat 4.0 uses a slightly different directory structure than Tomcat 3.2, but the web application directory is still named webapps. This means that you can install the example application exactly as described in the book: copy the ora directory from the jspbook.zip file to webapps/ora. That’s all there’s to it.

If you like to use the example custom tag library in another application, you can take advantage of the new auto-discover feature for tag libraries introduced in JSP 1.2. This way you don’t have to mess around with tag library declarations in the web.xml file. See my JSP 1.2 article for details.

That said, I recommend that you migrate to the JSP Standard Tag Library (JSTL) instead of using the custom tag library from the first edition of the book. The second edition of the book covers all you need to know to use the JSTL actions.

The toaster and the wolf: the cover story

My copy of the first edition of your book has a toaster on the cover, but your site, Amazon.com and others show a cover with a wolf. What’s going on?
Answer:
For the first edition, the first printing came out with the toaster cover. And even though it was released in December 2000, the printing history incorrectly says January 2001. I guess the publisher was not sure it would make it out in December.

O’Reilly has now decided to use animal covers for all their books, including the Java series. So the latest printing has the wolf cover instead. Similar changes will be done to all O’Reilly Java books, and some of them are already out. You can read more about this change at the O’Reilly site, and also let them know what you think about it.

The second edition of the book will have the wolf cover in all printings, unless O’Reilly change their mind again :-)