站内搜索: 请输入搜索关键词
当前页面: 图书首页 > Servlets and JavaServer Pages: The J2EE Technology Web Tier

Servlets and JavaServer Pages: The J2EE Technology Web Tier

[ directory ]SQL Tags Summary

Justification for Skipping the SQL Tags

In this book there are many programming practices that are promoted but have a good chance of being misinterpreted. It is clearly stated in countless places, including the introduction and back of the book, that this book takes a Java skill set and applies it to Servlets and JSP to create good Web Applications. By "good", potentially complex is meant. You bought a book because you wanted direction and advice on doing things with Servlets and JSPnot just simple, figure-it-out-in-five-minute things, but also the hardest of tasks. Purposely discouraging use of select JSTL tags might appear to go against this, but it is the goal of this book that justifies skipping these tags.

All of the JSTL tags are designed to be simple to learn. They provide the same functionality an experienced Java developer has available but through a non-programming interface. In other words, Java allows a developer to do anything but requires learning a lot more before being able to start doing a little. The JSTL requires someone to learn very little but be able to do a lot, not as much as pure Java, but enough for building simple Web Applications. The JSTL SQL tags are intended for the cases where understanding or using as little Java as possible is desired. These types of cases do not merit a full book! You can figure this out in a matter of minutes, do an adequate job of building a Web Application, and save yourself $50 and some shelf space. You are encouraged to do this should the situation arise. However, in cases where you need to build something complex and build it right, a solid understanding of Java, Servlets, and JSP are what you need. That is what merits buying this book, and that is what this book is about.

Any Java developer will agree the larger a project gets, the more critical a good design pattern is to ensure the project is successful. Good design patterns do not pop into your head after five minutes of wishing you did not have to learn Java. Good design patterns evolve from the use of a technology and experience of other developers who previously did the same type of project. Should it be obvious or not, this book is preparing you for a sound understanding of good, proved JSP and Servlet design patterns, specifically the Model 2, or MVC design pattern, with an emphasis on how this allows for good internationalization support, multi-client support, and future project maintenance. The JSTL SQL tags do not fit into this overall goal. They promote a limited Model 2-conflicting use of the functionality JSP and Servlets provide and that is why they are skipped. The authors would say to never use these tags, so why are they in the JSTL? There are two arguments given for their inclusion: first, prototyping. If you are prototyping, you often need a "quick and dirty" solution; the JSTL SQL tags are a quick and dirty SQL solution. Second, if you are writing a small Web Application (maybe a page or two), in which case you may feel that using MVC is overkill. However, you should remember that small applications quickly grow to be large applications, and using these tags may lead to all sorts of maintenance headaches.

On a slight tangent, if you truly desire to be a J2EE expert, it is wise to understand all of the options available to a Java, JSP, and Servlet developer. This allows you to make an informed and appropriate decision on a case-by-case basis when developing Web Applications. Understanding when JSP and Servlets are an overkill is helpful to save time and effort. A good understanding of the full JSTL is helpful in this regard as it nicely complements simple applications. If you are interested in a good, comprehensive discussion of the JSTL, we suggest the following book, JSTL in Action (ISBN 1930110529), by Shawn Bayern. He is the JSTL implementation leader, and explains all of the intricate uses of the JSTL.

[ directory ]SQL Tags Summary