pradeep
pradeep

Reputation: 221

all @RequestMapping into header page (SPRING MVC)

how to get all @ReqpuestMapping

i have a header page and some other pages

my header page has sidebar menus, i want to display my menu into all pages

Thanks Pradeep

Upvotes: 0

Views: 358

Answers (2)

Rahul Agrawal
Rahul Agrawal

Reputation: 8971

If you are using some Layout Frameworks like Tiles, etc then you can configure your layout in xml configuration files.

or if you are not using any Layout Framework, and you are using plain jsp pages then create separate pages like header.jsp, footer.jsp, menu.jsp and include these pages in all your other pages, wherever required.

Ex.

<body>        
<table>
    <tr>
     <td>
         <jsp:include page="menu.jsp"/> 
     </td>
    </tr>
    <tr>
     <td>
        Actual page code will go here
     </td>
    </tr>
    <tr>
     <td>
         <jsp:include page="footer.jsp"/> 
     </td>
    </tr>
</table>
</body>

Upvotes: 0

gresdiplitude
gresdiplitude

Reputation: 1685

If following is what you are trying to do, Apache Tiles is well suited for you requirement.

Apache Tiles™ is a templating framework built to simplify the development of web application user interfaces.

Tiles allows authors to define page fragments which can be assembled into a complete page at runtime. These fragments, or tiles, can be used as simple includes in order to reduce the duplication of common page elements or embedded within other tiles to develop a series of reusable templates. These templates streamline the development of a consistent look and feel across an entire application.

It also integrates well with spring. You can start looking at the Spring reference to integrate with Apache tiles. A simple tutorial here.

Upvotes: 1

Related Questions