3

the title of this post might be confusing.I'll try be best to clarify it. I Started a project using Spring MVC it works fine no problem.After that i've realized that i was a bit overkill and found that i needed a front controller dispatcher because all a wanted was nice urls without extensions.

So instead of implementing a whole new font controller i will like to take advantage of the existing Spring MVC setup. here is an example of a controller

 @RequestMapping("/accounts")
public String home() {

    return "accounts";
}

 @RequestMapping(value="/")
public String Home(){
    return "home";
}

as you can see, the return string is the one indicating the view based on the resourceviewresolver

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  <property name="prefix" value="/views/" />
  <property name="suffix" value=".jsp" />
</bean>

now i don't want to use the controller, but need a mechanism to map the request to a physical page.i'm wondering if that could be possible.

How can i do that? i should simply create another dispatcher?

thanks for reading this and helping out.

1 Answer 1

4

Spring 3 supports <mvc:view-controller> element for such cases:

<mvc:view-controller path="/" view-name="home" />
<mvc:view-controller path="/accounts" view-name="accounts" />

See also:

Sign up to request clarification or add additional context in comments.

1 Comment

by the way, will the use of parameters involves use of controllers? thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.