1

currently I'm using a JSP templating system which uses this example's lib ("/WEB-INF/tlds/template.tld").

I'm not even sure how it's called.

Anyway it seems like it's not too developed, it makes problems with form POST method, I have no idea who made it (just found it) and I've heard about Apache's Struts & Tiles.

I'm not even sure that Struts does what I'm talking about.

Down to business:
A page in my site has this JSP content, that utilizes the template:

<%@ taglib uri="/WEB-INF/tlds/template.tld" prefix="template"%>
<template:insert template="/WEB-INF/main_template_page/template.jsp">
    <template:put name="title" content="Title here" direct="true" />
    <template:put name="content" content="/content.jsp" />
</template:insert>

The template is:

<%@ taglib uri='/WEB-INF/tlds/template.tld' prefix='template'%>
<html>
<head>
<title>
    <template:get name='title' />
</title>
<link type="text/css" rel="stylesheet" href="/styles.css" />
</head>

<body>

    <div id="div_header">
        <div class="content">
            <%@include file='header.html'%>
        </div>
    </div>

    <div id="div_content">
        <template:get name='content' />
    </div>

    <div id="div_footer">
        <%@include file='footer.html'%>
    </div>

</body>
</html>

So as you see each page gives the template some parameters and it all works nice.

Is there a "well-established" system that does that? I'm sure there is; What its name? Which would you use for pretty much simple pages, but, has to support dynamic ones with code (JSP).

Poni
  • 11,061
  • 25
  • 80
  • 121

2 Answers2

1

Apache Tiles and Sitemesh are the two most popular systems. Tiles is more in keeping with what you demonstrated.

Quaternion
  • 10,380
  • 6
  • 51
  • 102
1

Quaternion is right that Tiles and SiteMesh are both pretty popular decoration frameworks. You can also use JSP .tag files to achieve this, as shown in this answer.

I've never used SiteMesh, but I've worked on several projects at work that use Tiles and I don't care for it -- to me it's just an extra layer that doesn't add enough bang-for-my-buck. Tag files have the added bonus of being a built-in part of JSP.

Community
  • 1
  • 1
Steven Benitez
  • 10,936
  • 3
  • 39
  • 50
  • I think you'd get the bang for you buck if wild card support was finally added to the struts2-tiles plugin. If used properly tiles achieves a higher level of factoring than possible by tag libraries. The tiles project may be commited to the apache attic (if it isn't already, haven't checked). It does most everything they currently sought to do, but without up keep... so long term outlook favors sitemesh, or your approach keeps it simple. – Quaternion Aug 23 '11 at 19:05
  • Thank you both Steven & Quaternion - decided to go with (the simpler) tags system. Appriciate the time taken to answer, and Steven, thanks for letting me know about these TAGS, wouldn't known better (: – Poni Aug 24 '11 at 03:28