Reusing a template page in Spring MVC

What is the best and easiest technology of the following?

Tiles, speed or freerider?

Thanks.

+5
source share
1 answer

There is no “best”, but it’s good to know that JSP as a viewing technology already provides a tag <jsp:include>for this. For example.

<!doctype html>
<html lang="en">
    <head>
        <title>SO question 2158749</title>
    </head>
    <body>
        <jsp:include page="menu.jsp" />
        <h1>Content</h1>
    </body>
</html>

where you can simply encode menu.jspas if it were part of the parent page:

<ul>
    <li><a href="home">Home</a></li>
    <li><a href="faq">FAQ</a></li>
    <li><a href="content">Content</a></li>
</ul>

There are two “standard” alternatives: directive @includeand JSTL <c:import>.

, @include ( , ), <jsp:include> ( , ).

, <c:import> , , , , <jsp:include> @include, <c:import> , . .

<c:import url="http://google.com" />
+14

All Articles