Chapter 7. Getting started with Spring Portlet MVC
This chapter covers
- Spring Framework basics
- Handlers or controllers
- Handler mappings
- Handler interceptors
- Exception handling
In earlier chapters, you learned about the portlet lifecycle and core concepts of the Java portlet technology. You developed the Book Catalog portlet by extending the GenericPortlet class and writing action and render methods containing navigation and validation logic, along with action processing and content generation logic. The portlet class acted as a controller, responsible for data validation, dispatching requests to appropriate JSPs, preparing data for the JSP pages, and encapsulating calls to business services.
As more and more features are added to a portlet, the portlet class becomes bloated with extra responsibilities, resulting in unfocused and unmanageable code. To deal with a bloated controller class, you can split the request-processing responsibilities into more focused components or classes by using a portlet framework. Web or portlet frameworks make use of best design practices and patterns to simplify development. Some of the widely used web frameworks, like Struts, JSF, and Wicket, currently let you develop portlets by bridging the differences between portlet and servlet technologies.