Spring, how do I set the file shown when / is hit?
With Spring MVC 3, when a user goes to http://localhost/myspringapp/ how do I decide wh开发者_如何学Goat page they will see? I currently get a 404.
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
.
精彩评论