-
Dec 29th, 2008, 10:13 AM
#1
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...
<action path="/flush"
type="org.apache.struts.actions.ForwardAction"
parameter="/WEB-INF/pages/flush.jsp"
roles="admin"/>
...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.
Thanks.
-
Dec 29th, 2008, 03:25 PM
#2
you could use the ParameterizableViewController for view only redirections. It can be configured as follows
<bean id="aboutController"
class="org.springframework.web.servlet.mvc.Paramet erizableViewController">
<property name="viewName" value="view" />
</bean>
-
Dec 29th, 2008, 03:33 PM
#3
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>.
Thanks again.
-
Dec 29th, 2008, 04:01 PM
#4
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" />
</bean>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules