JSP model 2 architecture
JSP Model 2 is a complex
In a Model 2 application, requests from the
Model 2 is recommended for medium- and large-sized applications.
History
In 1998, Sun Microsystems published a pre-release of the
The second model referred to by the document ("model 2" in the ordering) was an improved method that combined
In December 1999, JavaWorld published an article by Govind Seshadri entitled Understanding JavaServer Pages Model 2 architecture.[2] In this article, Govind accomplished two major milestones in the use of the term "Model 2". The first milestone was to formalize the term "Model 2" as an architectural pattern rather than one of two possible options. The second milestone was the claim that Model 2 provided an MVC architecture for web-based software.[3]
Govind believed that because "Model 2" architecture separated the logic out of the JSP and placed it in a servlet, the two pieces could be seen as the "View" and the "Controller" (respectively) in an MVC architecture. The "Model" part of the MVC architecture was left open by Govind, with a suggestion that nearly any data-structure could meet the requirements. The specific example used in the article was a
In March 2000, the
Since the release of Struts, a number of competing frameworks have appeared. Many of these frameworks also claim to implement "Model 2" and "MVC". In result, the two terms have become synonymous in the minds of developers. This has led to the use of the term "MVC Model 2" or "MVC2" for short.
Misconceptions
A common misconception is that a formalized MVC pattern is required to achieve a Model 2 implementation. However, the Java BluePrints specifically warn against this interpretation:[5]
The literature on Web-tier technology in the J2EE platform frequently uses the terms "Model 1" and "Model 2" without explanation. This terminology stems from early drafts of the JSP specification, which described two basic usage patterns for JSP pages. While the terms have disappeared from the specification document, they remain in common use. Model 1 and Model 2 simply refer to the absence or presence (respectively) of a controller servlet that dispatches requests from the client tier and selects views.
Furthermore, the term "MVC2" has led many to a mistaken belief that Model 2 represents a next-generation MVC pattern. In fact, MVC2 is simply a shortening of the term "MVC Model 2".[6]
The confusion over the term "MVC2" has led to additional confusion over Model 1 code, resulting in common usage of the nonexistent term "MVC1".
See also
- Apache Strutsis an open-source framework for implementing web-applications based on a Model 2 architecture.
References
- ^ JSP 0.92 Specification
- JavaWorld. Retrieved 2020-07-17.
- ^ a b How Struts Implements Model 2 (The Origins of Model 1/Model 2)
- ^ "Struts 1.x Homepage". Archived from the original on 2010-09-23. Retrieved 2010-10-05.
- ^ Java BluePrints 4.4.1: Structuring the Web Tier
- ^ Struts, an open-source MVC implementation
External links
- Seshadri, Govind (December 29, 1999). "Understanding JavaServer Pages Model 2 architecture". JavaWorld. Retrieved 2020-07-17.
- A History of MVC, Including Model 2
- ASP.NET Presentation Patterns - In this article Dino Esposito discusses how Model2 is also used in ASP.NET MVC.