views:

149

answers:

1

What is the best and easiest technology from the followings?

Tiles, velocity or freemaker?

Thank you.

+1  A: 

There's no "best", but it's good to know that JSP as being a view technology already provides the <jsp:include> tag for this. E.g.

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

where in you can just code menu.jsp as if it's a 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: the @include directive and the JSTL <c:import> tag.

The difference is that the @include directive includes the page during compile time (thus it will happen only once), while the <jsp:include> includes the page during runtime (which has actually the benefit that you can include another dynamic content).

Further is the difference of <c:import> that it includes the generated output of the page and thus not the source code as both <jsp:include> and @include does. The major benefit of <c:import> is however that you can include external resources this way. E.g.

<c:import url="http://google.com" />
BalusC
Another way to thank for the answer is to upvote the answer you found useful. Keep the spirit of Stackoverflow. Also see the "about" and "faq" links at the top bar. Oh, *one* dot at end of a sentence is really enough :)
BalusC
thank you very much.
Chamikara
This is the first time that I use a forum like this, so sorry for my mistakes. thanks.
Chamikara
You're welcome. Keep the quality in! ;)
BalusC