Model 1
Encyclopedia
In the design of Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 Web application
Web application
A web application is an application that is accessed over a network such as the Internet or an intranet. The term may also mean a computer software application that is coded in a browser-supported language and reliant on a common web browser to render the application executable.Web applications are...

s, there are two commonly used design models, referred to as Model 1 and Model 2
Model 2
In the design of Java Web applications, there are two commonly used design models, referred to as Model 1 and Model 2.Model 1 is a simple pattern whereby the code responsible for the display of content is intermixed with logic. Model 1 is only recommended for small applications and is mostly...

.

In Model 1, a request is made to a JSP
JavaServer Pages
JavaServer Pages is a Java technology that helps software developers serve dynamically generated web pages based on HTML, XML, or other document types...

 or servlet and then that JSP or servlet handles all responsibilities for the request, including processing the request, validating data, handling the business logic, and generating a response. The Model 1 architecture is commonly used in smaller, simple task applications due to its ease of development.

Although conceptually simple, this architecture is not conducive to large-scale application development because, inevitably, a great deal of functionality is duplicated in each JSP. Also, the Model 1 architecture unnecessarily ties together the business logic and presentation logic of the application. Combining business logic with presentation logic makes it hard to introduce a new 'view' or access point in an application. For example, in addition to an HTML
HTML
HyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....

 interface, you might want to include a Wireless Markup Language
Wireless Markup Language
Wireless Markup Language , based on XML, is a markup language intended for devices that implement the Wireless Application Protocol specification, such as mobile phones. It provides navigational support, data input, hyperlinks, text and image presentation, and forms, much like HTML...

(WML) interface for wireless access. In this case, using Model 1 will unnecessarily require the duplication of the business logic with each instance of the presentation code.

Multiple view pages can also share content, business logic, validation, and other features by including reusable elements or components. For example, in Java JSP the application developer can define a new taglib that implements the shared features. File includes is an additional mechanism that promotes reuse. Thus, it is possible to make a "Model 1" architecture have comparable features to "Model 2" architecture with the advantage that application do not need to implement processing code in a general-purpose language that are most suitable to complex computations. A suitable designation for this would be a "Model 1.5" architectures, where application code is invoked only in the (rare) instances where non-stereotyped or complex processing is required.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK