开发者

Change default homepage for Roo generated app using SpringMVC

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


In your webmvc-config.xml, replace the following section:

<!-- selects a static view for rendering without the need for an explicit controller -->
<mvc:view-controller path="/" view-name="index" />

with a view name you prefer.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜