29.01.2013 Views

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Input Page<br />

(View)<br />

Display Page<br />

(View)<br />

Figure 2-7 Model 2 architecture application flow<br />

2.3.3 MVC architectural pattern<br />

1<br />

Request<br />

Response<br />

5<br />

Serlvets<br />

(Control)<br />

Display Page<br />

JSP<br />

(View)<br />

Model 1 versus Model 2: It is not the intention of this publication to single out<br />

any one model as being better than the other. For the purposes of <strong>WebSphere</strong><br />

<strong>Application</strong> <strong>Server</strong> - Express and the targeted market of <strong>WebSphere</strong><br />

<strong>Application</strong> <strong>Server</strong> - Express, the Model 1 architecture is better suited. As<br />

mentioned earlier, Model 1 architecture lends itself towards small projects that<br />

can be developed quickly or when development teams do not have strong<br />

Java servlet skills. That said, it is important to note that using the Model 1<br />

architecture will hinder future scalability of applications. Extending the<br />

application using Model 1 architecture becomes difficult since the page<br />

presentation is so tightly coupled to the business logic. If a project is planned<br />

for future growth, then a Model 2 or MVC architecture is recommended and<br />

encouraged. It may be beneficial to “pay now versus pay later” to gain the<br />

flexibility provided by the MVC design pattern.<br />

The model-view-controller architectural pattern was conceived in the mid-1980s<br />

by developers of the Smalltalk-80 GUI library. It has since then been extensively<br />

applied in most object-oriented user interface and application control toolkits. It<br />

has also been generalized as a pattern for implementing the separation of<br />

concerns among application layers in general, not only the three originally<br />

proposed layers.<br />

According to the MVC pattern, a software component (an application, a module,<br />

and so forth) should separate its business logic (the model) from its presentation<br />

(the view). There are many reasons for this requirement, among which are the<br />

following.<br />

28 <strong>IBM</strong> <strong>WebSphere</strong> <strong>Application</strong> <strong>Server</strong> - Express V5.0.2 Developer Handbook<br />

3<br />

Interactive<br />

2<br />

4<br />

<strong>Application</strong> <strong>Server</strong><br />

JavaBean<br />

(Model)<br />

Database

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!