Jan 2nd, 2009, 11:44 AM
Spring Portlet MVC
Is there any way we can handle browser back button resubmit with all the new parameters?
I am using AbstractWizardFormController. Resubmit simply ignore the form changes. I was doing debuging but not able to get any idea. But on back button portlet never call action as mentioned in the specification. so it are any way we can handle this.
two phases of a portlet request: the action phase and the render phase. See the JSR-168 spec for more details on these two phases. Be especially aware that the action phase is called only once, but that the render phase will be called repeatedly by the portal
Jan 2nd, 2009, 04:13 PM
Little more explaination
As in the normal Spring MVC, It is working fine. I just override the isFormSubmission method.
But in the Spring Portlet MVC when user use the back button and submit the form with some changes. It just ignore the changes. As per documentation it is saying "portlet can have two distinct phases: the action phase and the render phase. The action phase is executed only once and is where any 'backend' changes or actions occur, such as making changes in a database. The render phase then produces what is displayed to the user each time the display is refreshed." so on the browser back button request never goes to handleActionRequestInternal. Then i tried to find the way to check request is coming from back button submittion. and override the renderInvalidSubmit method as below. But render request never has the updated values.
Is there any way we can find that this is the limitation in the Spring portlet MVC?
protected ModelAndView renderInvalidSubmit(RenderRequest request, RenderResponse response)
Object command = getRenderCommand(request);
PortletRequestDataBinder binder = bindAndValidate(request, command);
BindException errors = new BindException(binder.getBindingResult());
return renderFormSubmission(request, response, command, errors);
Jan 5th, 2009, 05:22 PM
If you are successfully going back and resubmitting the form, then it should be creating an Action Request as it did the first time, as long as the URL used by the form is portlet ActionURL.
Back Button issues in Portlets are usually in the domain of the Portal you are using, and not something you can deal with at the Portlet level. You might need to research how your specific Portal platform handles the Back Button. Some handle it relatively well -- others handle it very badly.
Jan 7th, 2009, 09:23 AM
Thanks alot to give the right direction for the problem. I got the solutions. I am using IBM portal so there is setting to call action multiple times. There is the settings in the portlet.xml
Jan 8th, 2009, 03:28 PM
Is there an easier way to convert the non portlet Spring MVC Web Applications to Portlet Applications than changing the code extensively..
I read abt the Bridges that convert for converting non Facelt JSP Applications into Portlet Apps..
Jan 8th, 2009, 04:49 PM
I'm not aware of a "Spring MVC bridge" for portlets. There are some generic Servlet bridge approaches that might work.
I wouldn't personally wouldn't advocate for such a thing because I think the design of a portlet and the design of a regular webapp should be very different from each other, and you need access to the unique features of the portlet API in order to build a portlet correctly (things like different displays depending on window state, and leveraging the ability to keep displays current via repeated render requests) -- bridges hide all of these unique features.