I'm using Spring's SimpleFormController
for form processing. In my case, the edit view (JSP) can vary depending on what's being edited. SimpleFormController
's formView
is a field (class variable) which means that it's shared by all threads that use the instance of it. Thus it's not safe (nor appropriate) to set the formView (via setFormView
) in formBackingObject
. My question is, is it possible to use SimpleFormController
with different edit views based on some context?
Follow up: After looking at the source it appears that I can override showForm(HttpServletRequest req, HttpServletResponse resp, BindException errors)
and call showForm(HttpServletRequest req, BindException errors, String viewName)
with whatever view I want.