How to add a custom page into Spring Roo

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.

 

I made some mistakes and it took me long time to figure it out.

What it does is add “/WEB-INF/views/custompage.jspx" this page to the path /custompage

 

Advertisements

3 thoughts on “How to add a custom page into Spring Roo

  1. I am getting resource not found error..can u pls brief me the last step..?

    What it does is add “/WEB-INF/views/custompage.jspx” this page to the path /custompage

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s