Model View Controller
Architecture
In Model 1, a request is made to a JSP and then
that JSP 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.
JSP Model 2 Architecture
Model 2 is a complex design pattern used in the
design of Java Web applications which separates the display of content from the
logic used to obtain and manipulate the content. Since Model 2 drives a
separation between logic and display, it is usually associated with the
model–view– controller (MVC) paradigm
In a Model 2 application, requests from the
client browser are passed to the controller. The controller performs any logic
necessary to obtain the correct content for display. It then places the content
in the request (commonly in the form of a JavaBean or POJO) and decides which
view it will pass the request to. The view then renders the content passed by
the controller. Model 2 is recommended for medium- and large-sized applications.
In JSP Model 2 architecture, JSP is used for
creating the view for the application. A centralized S ervlet is used to handle
all the request for the application. The Servlet works as the controller for
the application. It then uses the Java beans for processing the business logic
and getting the data (Model) from the database. Finally it uses the JSP to
render the view which is displayed to the user. The MVC architecture is very
popular architecture and there are many frameworks available for developing
Java based web applications. MVC based frameworks are: Struts 2 , JSF , Spring
MVC etc.
Scripting elements calling servlet code
directly
•
Scripting elements calling servlet code indirectly (by means of utility
classes)
• Beans
•
Servlet/JSP combo (MVC 2)
• MVC 2 with JSP expression language (JSP 2.1)
• Custom
tags
• MVC
with beans, JSTL tags, and a framework like Struts or JSF.
MVC2 Architecture is needed when: – A single
request will result in multiple substantially different-looking results. – You
have a large development team with different team members doing the Web
development and the business logic. – You perform complicated data processing,
but have a relatively fixed layout.
perfect explanation about java programming .its very useful.thanks for your valuable information.Best java training in chennai | Best java training in velachery
ReplyDeleteThanks for your valuable feedback, we will update more and more
ReplyDelete
ReplyDeleteVery informative ..i suggest this blog to my friends..Thank you for sharingjava training in chennai | java training institutes in chennai | java j2ee training institutes in velachery