The MVC Pattern

Until now, you've been using what the programming hotshots call “model 1” designs. In a model 1 site, the JSP provides both the display and the flow control of the site, and it hooks up to the business logic as well.

Model 1 sites have a couple of problems, especially when you start dealing with large, complex applications. For one thing, the JSP starts to get pretty unwieldy because you have to place more flow control into it.

In addition, you end up with a lot of cases in which you begin to process a JSP, realize that you need to move on to the next step, and have to do a redirect in the middle of the file.

You also find yourself with hard-coded URLs throughout your JSP and have a huge task on your hands every time you want ...

Get MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.