We've been working on porting a fairly complex enterprise application from the Spring Servlet MVC framework to the Spring Portlet MVC framework. As Nick Lothian and Rainer Schmitz discovered, the Form Controller hierarchy is difficult to port over from the Servlet area to the Portlet area because of the two-phase nature of portlet requests. Since we were porting a large number of existing controllers descended from AbstractController, AbstractFormController, or SimpleFormController, it was critical to that all the former functionality of these parent be present and that our logic work the same as before.
Nick Lothian's version of SimplePortletFormController gave us a good starting point and helped us understand a lot of the issues with portlet development in general and with Spring portlets in particular. However, a lot of our controllers manage database content, so we needed proper separation between the action and render phase of the request, which this controller did not give us.
Rainer Schmitz's work went much further and provided the traditional hierarchy of controllers and further demonstrated the issues with separating out the two phases of the portlet request. However, these still did not give us the complete control that we needed. We especially needed a version of SimpleFormController that could handle the separation of the action logic from the render logic.
Over the past few months we have developed a new set of the AbstractController, BaseCommandController, AbstractFormController, and SimpleFormController classes that we think rigorously address all the issues with portlet development and that have allowed us to port over existing servlet controllers with relative ease.
We've included a portlet version of WebContentGenerator to give the controller classes their proper ancestry and provide control over things like content caching and access to the web application context and to centralized logging.
We've also create a new set of the binding classes (PortletRequestDataBinder, PortletRequestParameterPropertyValues and PortletRequestBindingException) that support special field markers, correct problems with form elements such as radio buttons and checkboxes, and handle redisplay of invalid submits of non-string parameters properly.
All of the classes are fully documented, including workflow descriptions in the controllers that cover the special nature of portlet development.
Our hope is that these classes can handle the needs of everyone working with form controllers in Spring portlets and that these can be merged into the sandbox source code.
The classes are posted in a zip file on the Spring Portlet Wiki page at:
The link to the file is (sorry for the long link):
Please send me any questions or comments you may have about these classes. We are eager to support their adoption in the Spring Portlet community.