如何用springMVC 返回一个指定的HTML页面

如题所述

springMVC指定返回的html页面的方法如下:
在controller中:
@Controller
@RequestMapping("/index.html")
public class MyIndexController {
@RequestMapping(method=RequestMethod.GET)
protected String gotoIndex(Model model) throws Exception {
return "myLandingPage";
}
}
在web.xml中配置如下:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答