PDA

View Full Version : Portlet: Implementing "Save And New"


patrickherber
Jun 13th, 2007, 02:20 AM
Hello!
I have a Controller, which extends SimpleFormController, that is used to save changes of an Element object.
Usually on success, the user is "forwarded" to the Element-List page.
Now, beside the function "Save" on the form page, I would like to provide a "Save and new" function, which could be used to create more elements without the need each time to be "forwarded" to the list page (=> empty form => enter element Data => Save and new => empty form => ...).
I've tried to pass a parameter to the controller and accordingly set the the action parameter
if (actionID == SAVE_AND_NEW) {
response.setRenderParameter("action", "element");
} else {
response.setRenderParameter("action", "elementList");
}
but it does not work.
I've also tried to subclass my controller with one which specify a different successView (element instead of elementList), but this also didn't help.
How can I implement it?
Thanks a lot for your help.
Regards,
Patrick

patrickherber
Jun 13th, 2007, 07:24 AM
Hello,

reading following Post

http://forum.springframework.org/showthread.php?t=39989

I've found a solution to my problem.
I'd only to add following line to my controller:
response.setRenderParameter(getFormSubmitParameter Name(), "false");

Thanks a lot and regards,
Patrick

Jörg Heinicke
Jun 13th, 2007, 08:22 AM
From what I understand you also had the need to use different controllers for action and render phase and both controllers have a different form backing object?

http://forum.springframework.org/showthread.php?t=38451

Jörg