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.

7.1. Why use Spring Portlet MVC?

7.2. Dependency injection and the application context

7.3. A Hello World portlet, the Spring way

7.4. How Spring Portlet MVC works

7.5. Using DispatcherPortlet

7.6. Using the web application context

7.7. Using built-in controllers

7.8. Using built-in handler mappings

7.9. Using handler interceptors

7.10. Handling exceptions

7.11. Summary