Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Architecting JSP applications

Architecting JSP applications

Ratings: (0)|Views: 125 |Likes:
Published by api-25930603

More info:

Published by: api-25930603 on Oct 16, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





Architecting JSP applications
This chapter covers
Building applications with JSP alone
Learning to combine servlets and JSP pages
Understanding architectural tradeoffs
Architecting JSP applications

Now that we have covered the better portion of material on how to useJ SP to build dynamic web pages, we will look at how we can construct complete web applica- tions with this technology. In this chapter we will discuss several architectural mod- els useful for developingJ S P applications. We will examine architectural options available to us when we combineJS P pages with servlets,E JBs,H TM L, and other software elements to create web-based applications.

10.1 Web applications
When designing a web application of any complexity, it helps to think of its high-
level architecture in terms of three logical areas:
The presentation layer, the front end which controls the look and feel and
delivers results, also known as the view
The control layer, which controls application flow, also known as the controller
The application logic layer, which manages application data, performs calcula-
tions and communicates with back-end resources, also known as the model

The three layers (figure 10.1) aren\u2019t necessarily separate software elements or com- ponents (though as we shall see they can be), but rather they are useful constructs to help us understand our application\u2019s requirements. If you are familiar with design patterns, a collection of common strategies used in software development, you might recognize this three-part architecture as an implementation of the Model- View-Controller, orMV C, pattern. The M VC pattern is concerned with separating the information (the model) from its presentation (the view), which maps nicely into our strategy.

Each layer plays an important role in an applica- tion\u2019s architecture and will be discussed briefly in the sections which follow. It is often advantageous to treat each tier as an independent

portion of your application. Isolating the logical portions of the application helps ensure that you\u2019ve covered all the bases in the design, focuses attention on creating a robust architecture, and lays the groundwork for the implementation.

Do not confuse logical separation of responsibilities with actual separation of com-
ponents. Each tier does not necessarily need to be implemented by separate
Figure 10.1 Web application layers
Web applications
components. Some or all of the tiers can be combined into single components to
reduce application complexity, at the expense of modularity and high-level abstraction.
The presentation layer

This tier includes the client-side display elements, such asH T M L,X M L, or Java applets. The presentation layout tier can be thought of as the user interface for the application because it is used to get input from the end user and display the applica- tion\u2019s results. In theMV C paradigm, the presentation layout tier fills the role of the view. It is an application specific presentation of the information owned by the application logic, or model inM VC terms.

The presentation layout tier is not concerned with how the information was obtained, or from where. Its responsibilities lie only in displaying the information itself, while delegating any other activity up the chain to other tiers. For example, in an application which involves submitting a search query through a web form only the form itself and the corresponding results are the responsibility of the presenta- tion layer. What happens in between, the processing of the request and the retrieval of the results, is not.

Application logic

The application logic layer is the heart of the application, responsible for actually doing whatever it is the application is supposed to do. It is responsible for perform- ing queries against a database, calculating sales tax, or processing orders. This layer models the data and behavior behind the business process for which we are devel- oping the application. It is an encapsulation of data and behavior that is indepen- dent of its presentation.

Unlike the presentation layer, this tier cares only about storing, manipulating, and generating data, not displaying it. For this reason, components designed to work as application logic can be relocated outside web-based applications, since the behavior they encapsulate isn\u2019t web-centric.

Control layer

The control layer determines the application\u2019s flow, serving as an intermediary between the presentation layer and the application logic. This tier serves as the log- ical connection between the user\u2019s interaction with the front-end and business services on the back end. In theMV C pattern this tier is acting as the controller. It delivers the model to the view and regulates communication between the two.

This tier is also responsible for making decisions among multiple presentations,
when available. If a user\u2019s language, locale, or access level dictates a different

Activity (10)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
shahidrana1122 liked this
in1ne7a20 liked this
in1ne7a20 liked this
Vinay Srivatsa liked this
gopalmyneni liked this
deaddude liked this
maximus_2000 liked this
csbridge3442 liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->