Announcement Announcement Module
Collapse
No announcement yet.
A simple ForwardAction equivalent in Spring MVC Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #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>

    Comment


    • #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.

      Comment


      • #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>

        Comment

        Working...
        X