开发者

Spring, how do I set the file shown when / is hit?

开发者 https://www.devze.com 2023-01-16 19:36 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消