<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE></TITLE>
<META content="MSHTML 6.00.2800.1264" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff size=2>Let me
restate the problem - with much more definition.</FONT></SPAN></DIV>
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff size=2>I'm
writing a jsp page and trying to include a file (.html - or whatever) that has a
template defined for it (thus allow the user to create a body - but I define the
formatting, etc.). I call "cms.include("myPage.html");". The results
that I get are the BODY of the included file but not the Template stuff (my
formatting stuff - tables, etc.)</FONT></SPAN></DIV>
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff size=2>I've
created a very simple example (below) that shows exactly what I
mean.</FONT></SPAN></DIV>
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff size=2>Let's
say that I have the following template: (myTemplate.jsp)</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2><%@ page session="false" <BR>
import="com.opencms.flex.jsp.*"<BR>
import="com.opencms.flex.util.CmsMessages" <BR>
import="com.opencms.file.*" <BR> import="java.lang.*"
<BR> import="java.util.*" </FONT></SPAN></DIV>
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2>%><BR><%</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff size=2>//
initialise Cms Action Element<BR>CmsJspActionElement cms = new
CmsJspActionElement(pageContext, request, response);</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2>out.println("<h2>This is from the
template!!!</h2>");</FONT></SPAN></DIV><SPAN class=001344118-10112003>
<DIV><FONT face=Arial color=#0000ff size=2></FONT><FONT face=Arial
color=#0000ff size=2></FONT><FONT face=Arial color=#0000ff size=2></FONT><FONT
face=Arial color=#0000ff size=2></FONT><FONT face=Arial color=#0000ff
size=2></FONT><BR><FONT face=Arial color=#0000ff size=2>cms.include(null,
"body");</FONT></DIV></BLOCKQUOTE>
<DIV dir=ltr></SPAN><SPAN class=001344118-10112003><FONT face=Arial
color=#0000ff size=2>Also - let's say that you have a page (myPage.html) that
uses myTemplate.jsp - with the following body content:</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2><h3>This is the body
content</h3></FONT></SPAN></DIV></BLOCKQUOTE>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2>Good - now - let's say that we have the following JSP file -
(myJSP.jsp):</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2><%@ page session="false" <BR>
import="com.opencms.flex.jsp.*"<BR>
import="com.opencms.flex.util.CmsMessages" <BR>
import="com.opencms.file.*" <BR> import="java.lang.*"
<BR> import="java.util.*" </FONT></SPAN></DIV>
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2>%><BR><%</FONT></SPAN></DIV>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2>// initialise Cms Action Element<BR>CmsJspActionElement cms = new
CmsJspActionElement(pageContext, request, response);</FONT></SPAN></DIV>
<DIV><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2>%></FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2><html><BR><head><BR><title>Test
Page</title><BR></head><BR><body leftMargin="0" topMargin="0"
marginheight="0" marginwidth="0"></FONT></SPAN></DIV>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2><h1>This is myJSP.jsp</h1></FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2><%<BR>out.println("<h1>including
myPage.html.</h1>");<BR>cms.include("myPage.html");</FONT></SPAN></DIV>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2>%></FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2></body><BR></html></FONT></SPAN></DIV></BLOCKQUOTE>
<DIV dir=ltr><FONT face=Arial color=#0000ff size=2><SPAN
class=001344118-10112003>Ok - that's all of the files in this example.
When I open myJSP.jsp, the results are:</SPAN></FONT></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"><FONT face=Arial color=#0000ff
size=2><SPAN class=001344118-10112003>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2><html><BR><head><BR><title>Test
Page</title><BR></head><BR><body leftMargin="0" topMargin="0"
marginheight="0" marginwidth="0"></FONT></SPAN></DIV>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2><h1>This is myJSP.jsp</h1></FONT></SPAN></DIV>
<DIV dir=ltr><SPAN
class=001344118-10112003></SPAN> </DIV></FONT></SPAN><FONT face=Arial
color=#0000ff size=2></FONT></DIV>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2><h1>including
myPage.html.</h1><BR></DIV></FONT></SPAN><FONT face=Arial color=#0000ff
size=2>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2><h3>This is the body
content</h3></FONT></SPAN></DIV></FONT></SPAN></FONT></BLOCKQUOTE>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=001344118-10112003><SPAN class=001344118-10112003><FONT face=Arial
color=#0000ff
size=2></body><BR></html></FONT></SPAN></DIV></SPAN></FONT>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV></BLOCKQUOTE>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2>NOTE: I DON'T get the Template output -->
<h2>This is from the template!!!</h2></FONT></SPAN></DIV>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2>I don't understand why not - or how I CAN get it.</FONT></SPAN></DIV>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2>Any help in this would be appreciated.</FONT></SPAN></DIV>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr><SPAN class=001344118-10112003><FONT face=Arial color=#0000ff
size=2>Jim Polizzi</FONT></SPAN></DIV>
<BLOCKQUOTE>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Claus Priisholm
[mailto:cpr@codedroids.com]<BR><B>Sent:</B> Monday, November 10, 2003 5:57
AM<BR><B>To:</B> opencms-dev@opencms.org<BR><B>Subject:</B> Re: [opencms-dev]
Trying to include a file and have template applied<BR><BR></DIV></FONT><!-- Converted from text/enriched format -->
<DIV>I'm not sure what kind of include you're using (and what it is that you
need the template to do), but I had a problem where an include of a header
'page' would mess up the remaining includes on the page. In order for that to
work I would either have to use a Java URLConnection to actually fetch the
result or apply this workaround provided by Brett Beaumont: </DIV><BR>
<DIV>http://mail.opencms.org/pipermail/opencms-dev/2003q3/007010.html
</DIV><BR>
<DIV>On fredag, nov 7, 2003, at 17:00 Europe/Copenhagen, Polizzi, Jim wrote:
</DIV><BR>
<BLOCKQUOTE>
<DIV><FONT face=Arial><SMALL>I am trying to include a file (.html) that has
a template defined for it. The problem is that the file is included -
but the template is not applied... I'm ONLY getting the body content -
without the template</SMALL></FONT> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial><SMALL>Can anyone shed some light on
this?</SMALL></FONT> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV><BR></BLOCKQUOTE>
<DIV>-- </DIV>
<DIV>Claus Priisholm </DIV>
<DIV>+45 48 22 46 46 </DIV>
<DIV>cpr (you-know-what) interlet.dk - cpr (you-know-what) codedroids.com
</DIV>
<DIV>http://www.interlet.dk - http://www.codedroids.com
</DIV><BR></BLOCKQUOTE></BODY></HTML>