Using MVC in a Web Application
Most developers think of MVC in terms of a graphical user interface because MVC really came from GUI development. With a little imagination, however, you can extend the MVC paradigm to Web development, in terms of servlets and JSP. The idea is that you split your application into three sections. A servlet handles any requests from the browser and acts as a controller. You put your business logic (the model) in Java classes that are neither servlets nor Java Server Pages. Finally, you use Java Server Pages to display the view, a representation of the model.
When applying MVC to a Web application, you have to make some concessions toward the way the Web works. When you use MVC in a GUI application, you can display ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access