Drawbacks of the JSP Model 1 Architecture
By: Barbara in JSP Tutorials on 2008-12-09
The Model 1 architecture has one thing going for it: simplicity. If your project is small, simple, and self-contained, it's the quickest way to get up and running. But the previous example, although by no means large or complicated, already illustrates a number of the disadvantages of Model 1 architecture:
It becomes very hard to change the structure of such Web applications because the pages are tightly coupled. They have to be aware of each other. What if you decide that, after updating the quantities in a shopping cart, you want to redirect the user back to the catalog? This could require moving code from the shopping cart page to the catalog page.
Large projects often involve teams of programmers working on different pages, and in the Model 1 scenario, each team would have to have a detailed understanding of the pages on which all of the other teams were working; otherwise, modifying pages could break the flow of the application.
Pages that are linked to from many other pages have to handle those other pages' logic, such as a cart update. In this way, they can accumulate a large amount of code that hasn't got an awful lot to do with the page itself. This reduces their coherence, making them harder to understand and to maintain.
Presentation and application control logic are mixed up, making it hard for a Web designer to change the pages without messing up the Java code. And vice versa: it's very hard for a developer to change control logic that may be hidden in lots of HTML markup.
The lack of separation between presentation and logic means that providing multiple presentations carries a very high cost. What if you decide to sell pizzas via Wireless Application Protocol (WAP) or personal digital assistant (PDA) devices? These devices are radically different from Web browsers and require completely different presentation structure and formatting. Your only choice would be to produce a whole new set of pages and duplicate the application logic. You'd have to implement every subsequent change to the logic in more than one place. Soon enough, changes will become very hard to manage, and the implementations will start to diverge.
Of course, the obvious way to get around these problems is to separate out the presentation code from the application control logic. This leads you onto the next architecture, JSP Model 2 architecture.
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
- Data Science
- React Native
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews
Show a calendar for user input in JSP
Encrypting Passwords in Tomcat using Servlets
Steps to get a Free SSL certificate for your Tomcat
JSP Tags for SQL to connect to a database
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: `java.net.BindException: Permission denied <null>:80
Uploading a file to a server using JSP
Uploading an Image to a Database using JSP
A JSP page that gets properties from a bean
Querying Data with the JSTL in JSP