inner geek Education your technology Career Business About Us
 
Update your knowledge and master your skills
 
Geek of the Week
Community
About GirlGeeks
 
 

Search Keywords

 

Subscribe!
Enter your email to join GirlGeeks today!

HTML
Text
AOL



DownloadPlayer

JSP Professional JSP
By Brown, Burdick, Cokor, Falkner , Galbraith, Johnson, Kim, Kochmer, Kristmundsson, Li, Malks, Nelson, Palmer, Sullivan, Taylor, Timney, Tyagi, van Damme, Wilkinson

Chapter 6: Combining Servlets, JSP, and JavaBeans

As shown in Chapter 3, the use of Servlets allowed convenient management of events and program flow, but cumbersome ability to generate responses. Conversely in Chapter 4, the use of JSP provided excellent definition of response pages but gave maintenance concerns with scriptlets embedded in between HTML. Chapter 5 introduced beans as a way of eliminating some of that scriptlet code with easy yet powerful tags.

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:

  • Introduce the popular Model-View-Controller (MVC) architecture. In the development of Graphical User Interfaces, the MVC design pattern has emerged as a popular architecture for partitioning functionality.
  • Explore the MVC architecture and apply it to our time entry system. This useful but limited example will also dramatize the importance of comprehensive frameworks such as Struts, which is discussed in depth in Chapter 21.
  • Take a look at some advanced topics with Servlets and JSPs, such as HTTP Session Binding Events.
  • Discuss some advanced techniques for combining Servlets and JSP, including the use of event listeners.
The Model View Controller Architecture

Originating with Smalltalk designs, the MVC pattern partitions functionality into three interacting components — the Model, the View, and the Controller. You may ask why do you care? Often it is not always apparent where in your design functionality should reside. For example, is a piece of functionality better served using a JSP, Servlet, or a bean? Writing out all of your HTML from a bean is surely not the appropriate solution, just as putting all your business logic in a JSP is not appropriate.

MVC is a design paradigm where each component easily and naturally maps to our three main implementation technologies — beans, JSP, and Servlets. The Components of an MVC Architecture At a simple level, the components of MVC architecture interact as shown below. The Model holds the data, the View retrieves the data and generates a dynamic display, and the Controller provides the logic processing layer and delegation to the Model and View... ...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.

Back to top

Excerpted from Professional JSP by Brown et al Copyright ©2001 by Wrox Press Inc. Excerpted by permission of Wrox Press, Inc. All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.

 
 
 
 
 


Home|About Girlgeeks|Contact Us

GirlGeeks.org: All Rights Reserved.
GirlGeeks is a registered trademark; any unauthorized use is prohibited.