Adding a custom page in spring roo

感情迁移 提交于 2019-11-30 09:58:40

First of all edit your {project_root}/src/main/webapp/WEB-INF/spring/webmvc-config.xml and add new mvc:view-controller definition for your new page. Something like:

<mvc:view-controller path="/custompage" />

Then open {project_root}/src/main/webapp/WEB-INF/views/views.xml and add the following definition:

  <definition extends="public" name="custompage">
    <put-attribute name="body" value="/WEB-INF/views/custompage.jspx"/>
  </definition>

And add your custompage.jspx to the {project_root}/src/main/webapp/WEB-INF/views/ folder.

And then edit {project_root}/src/main/webapp/WEB-INF/views/menu.jspx and new menu:item with url="/custompage".

I think it should work.

Tal

The simplest way is to let Roo do it for you. Use controller class --class ~.web.CustomPageController --preferredMapping /custompage and Roo will create everything for you.

Make sure you only have what you need in the resulting controller since it won't work if you have more than one mapping per request (I think the default in 1.1.4 is that there is an ambiguous mapping for a simple 'get')

Ramesh

I did same. I got the same issue. Then I noticed webmvc-config.xml not having entry of <mvc:view-controller path="/custompage/index"/>. I put the entry and now it is working now. Make sure the presence of the above said code.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!