Results 1 to 4 of 4

Thread: A simple ForwardAction equivalent in Spring MVC

  1. #1
    Join Date
    Dec 2008
    Posts
    11

    Default 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. #2

    Default

    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>

  3. #3
    Join Date
    Dec 2008
    Posts
    11

    Default

    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.

  4. #4
    Join Date
    Dec 2008
    Posts
    11

    Default

    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
  •