It's holiday season so I've finally found a bit of time to create a version of the SimpleFormController cheat sheet for the portlet MVC. Once again, remember that this cheat sheet should be used in conjunction with the API and source code. It is not meant to be a comprehensive translation of the source code. Rather, it is meant to highlight important areas where your own implementation should hook in to the standard workflow.
When compared to the servlet, you can see that the portlet workflow differs mainly in the seperation of the action phase and render phase, as per the JSR-168 spec. Some main points of comparison to note:
- showNewForm() and showForm() will be called during the render phase (depicted on the LHS of the diagram).
- The 3 main stages of submission (backing object phase, bind and validate phase, process form submission phase) are found in the action phase (depicted on the RHS of the diagram).
- In the servlet version, we often need to bind the original form on sucessView, and we did this by calling showForm() during onSubmit(). The same thing is achieved in the portlet version by calling showForm() during onSubmitRender()
I've tweaked the colors slightly, so hopefully they will turn out a bit better on grayscale printers. The servlet version of the cheat sheet has been updated to keep the two cheat sheets consistent.
Hope you will will find this useful. Please leave comments and let me know if anything is wrong, or if there are any suggestions. Happy new year!Portlet SimpleFormController Cheat Sheet Servlet SimpleFormController Cheat Sheet