The Solution: (boy it is so easy if you know it!)
Ya, the solution was to override the showForm() method. But in a very simple way:
Code:
protected ModelAndView showForm(HttpServletRequest request, HttpServletResponse response, BindException errors, Map controlModel) throws Exception {
ModelAndView mav = super.showForm(request, response, errors, controlModel);
mav.getModelMap().put("guestbook", guestbook);
return mav;
}
This way of course both Views of the SimpleFormController can have an injected model bean, which can be accessed by via tags.
And because google results showed me that other people tried to use the SimpleFormController in a similar way:
If you want to redirect to the same Controller again (like to show his own recently made updates), use in the xml
Code:
<bean name="/guestbook.app" class="de.tum.in.dss.GuestbookController">
<property name="formView" value="GuestbookSite" />
<property name="successView" value="redirect:/guestbook.app" />
Also, the code in my first post was a bad way to call onSubmit! Do not do this, because it destroys the controler logic. Use super and return the manipulated values instead. Sorry, i'm new to spring (haha, everyone always says that).