- Shopping Bag ( 0 items )
Simpler, faster, easier dynamic website development based on new additions to an established and proven technologythat's what JavaServer Pages (JSP) 2.0 is all about. Pro JSP, Third Edition is the most comprehensive guide and reference to JSP 2.0 yet. It equips you with the tools, techniques, and understanding you need to develop web applications with JSP and Java servlets.
The new features of the JSP 2.0 and Servlet 2.4 specifications make developing web applications easier than ever before. The new JSP Expression Language (EL) provides a new, simple language for creating JSP pages and tags. In addition, by also using the JSP Standard Tag Library (JSTL), you'll never have to use a Java scriptlet or write spaghetti code again.
Beyond covering the JSP and Servlet APIs, this book shows you how to choose and implement the best persistence option for your web applications; how to secure your web sites against malicious attack and accidental misuse; how to improve the performance and scalability of your JSP pages; and how to architect and design your applications to be reliable, stable, and maintainable through the use of design patterns and best practices.
Finally, no JSP book would be complete today without looking at the role that open source projects such as Ant, Struts, XDoclet, JUnit, and Cactus can play in making your web development even easier.
This chapter attempts to unite the three technologies (Servlets, JSP, and beans) by blending the best of all three approaches. This approach solves most of the above problems. When we add custom tags in later chapters, we will complete the picture.
In this chapter we will:
MVC is a design paradigm where each component easily and naturally maps to our three main implementation technologies – beans, JSP, and Servlets.
...Let's now look at each of the major components of the MVC design pattern in turn. We'll look at what the component provides, and how it can be organized.
The Model can be further partitioned into State and Action components.
The State defines the current set of values of the Model and includes methods to change those values. These methods are where some of the business logic is captured.
The State components are usually protocol independent. JavaBeans are a logical choice for implementing the State components.
The reusable nature of beans allows for the somewhat independent construction of the State components. As far as being protocol independent, State components should be isolated enough so they can be accessed by applications that use HTTP, RMI, etc., that is, the protocol would be another layer on top of the component. Their construction should take into account current requirements and consider future growth and evolution. This independent construction facilitates sound design in these ways:
The Actions define the allowable changes to the State in response to events. Business logic also dictates the construction of Action components.
In implementing the Action components, the choices get more complex. In simple systems, the Actions may actually get absorbed into the Controller, but this is generally not recommended. Typically a layer of Action beans is created to capture the requirements that govern interaction with the State components. As far as our time entry system, the 'Summary' action represents an example of an Action component.
Often Action components must be aware of the protocol in order to obtain information about the event. This is a dangerous situation, as it ties business logic to a specific protocol, limiting potential reuse.
Some simple rules of thumb are helpful when constructing your Action components. Adapt and add to this list for your particular set of requirements:
As part of the generation of the user interface, the View is responsible for presenting the specific set of events that the user may enact at any given moment.
Separating the View from the Model enables the independent construction of user interfaces with different look and feel attributes. These different interfaces can all interact with the same Model. JSPs are a natural choice for implementing the View.
As we have seen, JSPs are a convenient choice for generating HTTP browser based user interfaces. Interaction with the Model (beans) is easy via the built-in beans tags.
With the full power of Java available to us, Servlets are an ideal selection for a Controller technology.
In an MVC architecture, the Controller (servlet) acts as a dispatcher. This presents some challenges that must be addressed. Specifically, the controller must handle the following tasks...
|About the Authors|
|Ch. 1||The Anatomy of a JavaServer Page||1|
|Ch. 2||Servlets and Deployment||43|
|Ch. 3||The JavaServer Pages Expression Language||91|
|Ch. 4||JavaServer Pages Standard Tag Library||131|
|Ch. 5||Tag Files and Simple Tags||179|
|Ch. 6||Classic Tags||217|
|Ch. 7||Custom Tag Advanced Features and Best Practices||253|
|Ch. 8||Data Access Options for Web Applications||285|
|Ch. 9||Introduction to Filtering||321|
|Ch. 10||Advanced Filtering Techniques||355|
|Ch. 11||Security in Web Applications||391|
|Ch. 12||Improving Web Application Performance and Scalability||431|
|Ch. 13||Web Application Design and Best Practices||451|
|Ch. 14||Using Struts, XDoclet, and Other Tools||485|
|App. A||JavaServer Pages Syntax Reference||547|
|App. B||JavaServer Pages Implicit Objects||563|
Posted June 21, 2001
The second edition of this book is what I expected to see from WROX. In contrast to the first edition, this book is well organized. This book covers most of the readers from beginner to professional. There is no more confusion like what I saw in the first edition of this book. I recommend this book to web developers that are using JSP.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.
Posted July 25, 2001
I think this book is outstanding in all phases--from the help they give configuring the tools you'll need along the way, to their excellent presentation of Servlet and JSP material. This is a must have for all J2EE developers getting a handle on advanced or novice concepts! This book takes a fairly complex subject and breaks it down into manageable sections so that you are not overwhelmed at the enormous amount of information. After all, the coding of J2EE apps isn't the most difficult part--it is in getting a professional handle on how to properly configure your web application.Was this review helpful? Yes NoThank you for your feedback. Report this reviewThank you, this review has been flagged.