|
From: Rainer S. <Rai...@ab...> - 2004-10-14 07:26:24
|
Aloha! I've made some changes to SimplePortletFormController: In the original implementation the ActionRequest does nothing but forwarding to the RenderRequest, adding a RenderParameter as marker. The form action is executed in the RenderRequest handling. The disadvantage of this approach is that the form action is re-executed on each render request, i. e. every time the portlet window state is changed or another portlet at the same page is called. I've changed the code so that the action is called in the ActionRequest handler. The result of this execution (or the form ModelAndView in case of bind errors) is forwarded to the RenderRequest handler as request attribute. This way, when the portlet gets re-rendered, the form action is not re-executed. Since the request attribute is lost, the original form is displayed. If you prefer to keep the form execution result displaye in this case, it has to be stored in the portlet session. This can be achieved by setting the property 'storeResultInSession' of SimplePortletFormController to true. One problem (or is it a feature?) remains: if there are two instances of the portlet at the same page, both will get the form execution result in the render request and thus will display the same content. I've found no way to namespace encode the request property use for the result forwarding. If anyone has an idea... I'll append the changed code to this message. Feel free to use it or give any comments. Cheers Rainer |