Dec 29th, 2008, 10:13 AM
A simple ForwardAction equivalent in Spring MVC
I'm a new to Spring MVC & I'm trying to figure a way to forward a request URI to a JSP. This is somewhat an equivalent of...
...in Struts. Is it possible to do this using plain configuration or is it mandatory that I implement the Controller interface (or the AbstractController class) to achieve this? Any info is appreciated.
Dec 29th, 2008, 03:25 PM
you could use the ParameterizableViewController for view only redirections. It can be configured as follows
<property name="viewName" value="view" />
Dec 29th, 2008, 03:33 PM
Thanks a lot for the update. Not to be picky, but I assume this is what you meant:
bean id="aboutController" - I suppose any name should be fine
property name="viewName" value="<actual view page like login.jsp>"
I'm assuming that somehow "viewName" is an internal property of the ParameterizableViewController class which is recognized and translated to fwd to the specified value <JSP>.
Dec 29th, 2008, 04:01 PM
Thanks again. Got this working. Instead of a bean id, I provided a bean name="<URI>" & it works. Something like-
<bean name="/login.app" class="org.springframework.web.servlet.mvc.Paramet erizableViewController">
<property name="viewName" value="login" />