[opencms-dev] Re: Use a template from JSPs

Thomas Joseph Olaes thomas.olaes at gmail.com
Thu Aug 5 02:09:01 CEST 2004


Check the JSP Scriptlet documentation module on the opencms.org website.

But what it says in there is you have to enclose the parts in tags

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

so in your JSP template, if you have the following template for your HTM pages

<%@ page session="false" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><cms:property name="title" escapeHtml="true" /></title>

<meta HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html;
CHARSET=<cms:property name="content-encoding" default="ISO-8859-1"
/>">

<link type="text/css" rel="stylesheet"
href="<cms:link>../resources/mystyle.css</cms:link>">

</head>
<body>

<h2>My first template head</h2>

<!-- Main page body starts here -->
<cms:include element="body" />
<!-- Main page body ends here -->

<h2>My first template foot</h2>

</body>
</html>

You now have:

<%@ page session="false" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

<cms:template element="head">

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><cms:property name="title" escapeHtml="true" /></title>

<meta HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html;
CHARSET=<cms:property name="content-encoding" default="ISO-8859-1"
/>">

<link type="text/css" rel="stylesheet"
href="<cms:link>../resources/mystyle.css</cms:link>">

</head>
<body>

<h2>My first template head</h2>

<!-- Main page body starts here -->
</cms:template>

<cms:template element="body">
<cms:include element="body" />
</cms:template>

<cms:template element="foot">
<!-- Main page body ends here -->

<h2>My first template foot</h2>

</body>
</html>
</cms:template>

then from your JSP page that uses the template, you do:

<cms:include property="template" element="head" />

<cms:include property="template" element="foot" />

to include the stuff in the <cms:template element="head" /> and
<cms:template element="foot" />  tags, respectively.

It's discussed way better than here in the actual documentation model.
Downloads are

http://www.alkacon.com/export/download/alkacon/com.alkacon.documentation_1.1.zip

and

http://www.alkacon.com/export/download/alkacon/com.alkacon.documentation.howto-template_1.1.zip

and you install it by accessing OpenCMS with an administrator account,
going to Administration View (select the view from the top bar),
clicking "Module management", selecting the Offline project in the top
bar, and clicking the button at the secondary top bar that has the
tool tip "Upload module from".

-TJ

On Tue, 03 Aug 2004 17:00:37 +0200, Christian Schmidt
<christian.schmidt at questico.de> wrote:
> Hello List,
> 
> we have the same problem and maybe someone else does as well. It would
> be very helpful to let JSP-pages be built according to a template. Our
> scenario would be something like a completely exported website
> containing jsp-code for a seperately built shop. Like this, the site
> could be content-wise maintained by editors (OpenCms) and programmers
> take care of the shop and jsp-code.
> 
> Any help or hints would be very much appreciated! Thanx in advance,
> 
> Christian
> 
> > From: Stoku at aol.com
> > Date: Fri, 30 Jul 2004 14:51:40 EDT
> > To: opencms-dev at opencms.org
> > Subject: [opencms-dev] Use a template from JSPs
> > Reply-To: opencms-dev at opencms.org
> >
> >
> > --part1_8d.10f7035f.2e3bf2bc_boundary
> > Content-Type: text/plain; charset="US-ASCII"
> > Content-Transfer-Encoding: 7bit
> 
> 
> >
> > Hi all,
> >
> >  I just learned how to create modules and I am trying to use templates. But I
> > can set a template for html pages, but can not set it for JSPs. Is there any
> > way to use templates from JSPs? I will appreciate your help.
> >
> > Sosuke
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
>



More information about the opencms-dev mailing list