[opencms-dev] help needed with templates and elements

Andy Kriger akriger at greaterthanone.com
Fri Sep 24 19:45:03 CEST 2004


I posted a message about this a couple week ago and got no reponse. I'm
trying again because I am still having this problem.

The souce code is more or less from example code posted in the docs/books. I
have a JSP template (see end of message for source code). This template is
able to be applied to an HTML file without problem. When I apply the
template to a JSP file (see end of message for source code), I am running
into several problems. 

1) I am unable to include both head & foot elements. When both elements are
included I get a ServletException on page load (FlexDispatcher: Detected
inclusion loop for target /gto/jspTemplateTest.jsp). If I comment out one of
the includes, the page loads (minus the commented out include). This isn't
good as I am unable to pick parts of a template to use in a content page.

2) The body element is not included correctly. In my final result, I only
see the paragraph elements of the JSP page, not the h2 element of the
template. I do see the head element included (with title element) so I know
that the JSP template is being applied to my JSP page. But something isn't
working quite right.

I suspect these two problems are related, but being new to OpenCms, I don't
know how. I was unable to find answers in the mailing list archives. Does
anyone have any tips, suggestions, ideas, or anything that would help me
resolve this problem?

thx
andy

===== JSP TEMPLATE =====

<%@ page contentType="text/html" language="java" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

<cms:template element="head">
<html>
<head>
    <title><cms:property name="title" escapeHtml="true"/></title>
</head>
<body>
</cms:template>

<cms:template element="body">
    <h2><cms:property name="title" escapeHtml="true"/></h2>
    <cms:include element="body"/>
</cms:template>

<cms:template element="foot">
</body>
</html>
</cms:template>


====== JSP FILE =====

<%@ page contentType="text/html" language="java" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

<cms:include property="template" element="head"/>
<p>Some text</p>
<p>Some more text</p>
<p>Even more text</p>
<cms:include property="template" element="foot"/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20040924/ce1d1945/attachment.htm>


More information about the opencms-dev mailing list