使用 SpringMVC 更改 Roo 生成的应用程序的默认主页
默认情况下,当 Web 应用程序启动时,它从 roo 生成的主页开始,视图名称为“index”
假设我使用以下命令添加新的自定义控制器,
web mvc controller ~.web.ViewHomeController --preferredMapping /homepage1
它会生成以下代码,
@RequestMapping("/homepage1/**")
@Controller
public class ViewHomeController {
@RequestMapping
public void get(ModelMap modelMap, HttpServletRequest request,
HttpServletResponse response) {
}
@RequestMapping(method = RequestMethod.POST, value = "{id}")
public void post(@PathVariable Long id, ModelMap modelMap,
HttpServletRequest request, HttpServletResponse response) {
}
@RequestMapping
public String index() {
return "home/homepage1";
}
}
我希望“home/homepage1”页面为Roo 应用程序启动时显示的默认页面。
我能否获得一些有关我需要进行更改以启用“home/homepage1”作为我的应用程序的默认主页的指导/详细信息。
提前感谢您的帮助。我正在使用最新版本的 Spring ROO,1.1.4。
谢谢
By default when the web app starts it starts with the home page generated by roo with view name as "index"
Suppose i add new custom controller using following command,
web mvc controller ~.web.ViewHomeController --preferredMapping /homepage1
It generates the following code,
@RequestMapping("/homepage1/**")
@Controller
public class ViewHomeController {
@RequestMapping
public void get(ModelMap modelMap, HttpServletRequest request,
HttpServletResponse response) {
}
@RequestMapping(method = RequestMethod.POST, value = "{id}")
public void post(@PathVariable Long id, ModelMap modelMap,
HttpServletRequest request, HttpServletResponse response) {
}
@RequestMapping
public String index() {
return "home/homepage1";
}
}
I want the "home/homepage1" page to be the default page to be shown when the Roo Application starts.
Can i please get some guidance/details on changes i need to make to enable "home/homepage1" as default homepage for my application.
Thanks for help in advance. I am using latest version of Spring ROO, 1.1.4.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 webmvc-config.xml 中,将以下部分替换
为您喜欢的视图名称。
In your webmvc-config.xml, replace the following section:
with a view name you prefer.