Title: Java EE 5 Development with NetBeans 6
Author: David R. Heffelfinger
Publisher: Packt Publishing
Price: £30.99
ISBN: 978-1-847195-46-3
Pages: 390
This book has been written for Java developers with no knowledge of NetBeans or Java Enterprise Edition (Java EE), who wish to develop Java EE applications using NetBeans. It promises to take the reader on a tour through the most important parts of Java EE programming, using screenshots and instructions to demonstrate how using NetBeans and its features can save time and enhance their development experience. Sounds good, but does Heffelfinger deliver and can someone with only a basic understanding of NetBeans and Java Standard Edition (Java SE) learn anything? Before I attempt to answer this question, here’s a quick summary of what’s in each of the books chapters.
Chapter 1, Getting Started with NetBeans, takes the reader through the process of downloading, installing and configuring NetBeans, before deploying the Corporate Travel Centre sample application that ships with NetBeans, to ensure that the GlassFish application server and JavaDB have both been correctly configured within the NetBeans environment.
Chapter 2, Developing Web Applications with Servlets and JSPs covers how to create Java EE web applications using Java Server Pages (JSP) and the Serverlet API, before looking at form based authentication as a means of securing web applications. Finally, the reader is shown how they can use the NetBeans HTTP monitor to keep track of what’s happening to their web applications.
Chapter 3, Enhancing JSP Functionality with JSTL and Custom Tags introduces the JSP Standard Tag Library (JSTL) as a way of building more readable and maintainable JSPs by relying less on JSP scriptlets. The two main areas covered are, how to use the Core and SQL JSTL tags, with the former showing how to decide which page to display (conditional logic) and how to display collections through the use of loops in JSPs, while the latter deals with inserting, retrieving, updating and deleting database data.
Chapter 4, Developing Web Applications using JavaServer Faces introduces the reader to web frameworks; once again Heffelfinger mentions some of the alternative non-standard web frameworks, before explaining that JavaServer Faces (JSF) was introduced as part of the Java EE specification.
Chapter 5, Interacting with Databases through the Java Persistence API guides the reader through the intricacies of using the Java Persistence API (JPA) via an example that uses the Model-View-Controller design pattern. During this process, NetBeans is used to generate JPA classes, JPA entities from a database and a complete JSF application from existing JPA entities.
Chapter 6, Visual Web JSF Development takes the reader through writing their first Visual Web Application, in a predominantly drag, drop and bind fashion. However, Heffelfinger points out that this isn’t always the quickest way to work as using code completion can be a faster option for some tasks.
Chapter 7, Implementing the Business Tier with Session Beans covers how to use session beans, including how to implement Aspect-Orientated Programming (AOP) via interceptors and how to use the Enterprise JavaBean (EJB) Timer Service to periodically invoke a session beans methods.
Chapter 8, Messaging with JMS and Message Driven Beans deals with the Java Messaging Service (JMS) and focuses on how the reader can use NetBeans to generate the required boilerplate code, leaving them free to focus on the applications business logic.
Chapter 9, Web Services introduces both SOAP and the Representational State Transfer (REST) before focusing on the former and guiding the reader through creating both a web service and a web service client. Once again NetBeans is used to generate the majority of the required boilerplate code.
Chapter 10, Putting it all Together takes the reader through the process of creating an Enterprise Project which takes advantage of some of the technologies explored in the earlier chapters and reinforces the learning experience.
Finally, there are two appendixes, A. Debugging Enterprise Applications with the Netbeans Debugger and B. Identifying Performance Issues with NetBeans Profiler. Both are brief in nature, but provide enough information to get the reader started.
As you may have guessed, Heffelfinger has written this book to guide the reader through creating the various applications using a step-by-step method, making extensive use of screenshots and highlighted code snippets to supplement the instructions. Heffelfinger doesn’t expect the reader to mindlessly follow these steps though, as he takes time to briefly explain about technologies and why we need to do certain things. An example of this is where Heffelfinger mentions alternative products before using a product that ships with NetBeans, in chapter 1 MySQL and Postgres are both mentioned and while they are popular RDBMSs and arguable more so than the Java DB, using either in this context would have added little of real value, and in all probability they would have simply been an unnecessary distraction. I appreciated the logic behind this approach and was pleased to see it used throughout the book.
Each of the chapters uses their own applications focusing on their particular technologies, which works well as it means the reader doesn’t have to move from one chapter to the next in a predefined order. Heffelfinger repeats relevant notes where they are required to aid the reader, or direct them to the relevant information should they choose to read the book out of sequence. I personally started at the beginning and worked my way through the book, however, I have no doubt that this flexible approach would benefit more knowledgeable readers who are interested in specific Java EE technologies or NetBeans features.
Alas this book isn’t perfect, to me if a book is based around the step-by-step style then I feel I should be able to create the applications from the book alone and not be forced into downloading the code samples. The step-by-step style was the case for the first couple of applications, however, once we moved onto Servlet Development in chapter 2, Heffelfinger opted to leave out a simple JavaBean, explaining that it was a simple JavaBean and therefore it was not shown, but at only thirty one lines of code, including comments was this really necessary? Unfortunately, this was not an isolated incident and the policy was prevalent throughout the remainder of the book.
As for the downloaded code samples themselves, I personally found these to be of a mixed quality, which isn’t to say the code or applications themselves are poor as they certainly achieve their aims, but is more a reflection of the randomness of whether they would run without modification or configuration, and while I accept that for some, configuration is required, it would have been beneficial if these steps were documented, possibly in an appendix. An example of this can again be found in chapter 2, where the Form Based Authentication code sample requires the Enable Authentication Constraint checkbox to be ticked, while the next code sample for Creating a JSP Fragment in NetBeans, comes with this checkbox already ticked. Despite this I managed to get all of the code samples, working without any major issues, except for those in chapter 9 which continue to frustrate me.
I enjoyed reading this book and found it easy to read, with the content pitched at the right level for its target audience, developers new to Java EE 5 and NetBeans. That isn’t to suggest it’s the only book on NetBeans or Java EE 5 that you’ll ever need to own, but then again I don’t believe this is Heffelfingers aim.
Rating: 4/ 5
© Hamish Hughson 2009 (Republished on the Scottish Developers website with permission)