Book Image

Java EE 5 Development with NetBeans 6

Book Image

Java EE 5 Development with NetBeans 6

Overview of this book

Table of Contents (17 chapters)
Java EE 5 Development with NetBeans 6
Credits
About the Author
About the Reviewers
Preface
Identifying Performance Issues with NetBeans Profiler

Servlet Development


Although the application developed in the previous section was fairly easy to develop, the resulting code isn't very maintainable. One of the JSPs has both business logic and presentation logic embedded in it. It is considered a best practice for JSPs to have only presentation logic, and keep the business logic elsewhere.

One common way to approach this problem is to use the Model-View-Controller (MVC) design pattern. This pattern provides a clean separation of concerns, providing artifacts that solely act as data (model), while other artifacts are solely responsible for displaying the data (view) and another artifact (or artifacts) is responsible for manipulating the data and transferring control to the view (controller). In Java web applications, JSPs typically act as the view, servlets act as controllers, and custom JavaBeans act as the model.

In this section we will modify the application we developed previously so that it follows this pattern.

Adding a Servlet to...