views:

22

answers:

1

With Spring MVC 3, when a user goes to http://localhost/myspringapp/ how do I decide what page they will see? I currently get a 404.

+3  A: 

You can set a mapping on a Controller:

@RequestMapping("/") @Controller
public class HomeController {
    @RequestMapping
    public String index() { /* your action */ }

You can also set a JSP file as welcome-file in your web.xml.

streetpc