Tiles vs. JSP includes

plodder picture plodder · Apr 1, 2010 · Viewed 8.2k times · Source

We have a large web-app with hundreds of jsps pages. To avoid repeating markup up blocks we are considering making use of apache tiles. Now it seems messy to have a combination of both

<t:insertTemplate template="/WEB-INF/templates/xxxxx.jsp">

and

<%@ include file="xxxxx.jsp"%>

statements so we are considering converting all includes statements to insertTemplates (whether or not the template includes any tile syntax)

Has anyone had any experience with using tiles 100% for jsp includes?

Answer

BalusC picture BalusC · Apr 1, 2010

You can do so. The major difference is however that @include directive is compiletime (thus, happens only once during startup) and that <whatever:include> tag is runtime (thus, happens on every request). For the case you didn't know that, JSP already offers <jsp:include> out the box for this.

It must now be obvious that the tag may be a performance hit when unnecessarily used.