<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Nachricht</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Alex,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>What I am trying to do is bit of Hack, I am trying
to do Templating with JSP that you have provided. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><B><FONT color=#8080ff size=2>
<P>public</B></FONT><FONT size=2> </FONT><B><FONT color=#8080ff
size=2>class</B></FONT><FONT size=2> JSPTemplate </FONT><B><FONT color=#8080ff
size=2>extends</B></FONT><FONT size=2> CmsXmlTemplate</P>
<P>{</P></FONT><FONT size=2>
<P></FONT><B><FONT color=#8080ff size=2>static</B></FONT><FONT size=2>
</FONT><B><FONT color=#8080ff size=2>final</B></FONT><FONT size=2> String
JSP_TEMPLATE = </FONT><FONT color=#2a00ff
size=2>"/flexdemo/default.jsp"</FONT><FONT size=2>;</P>
<P></FONT><B><FONT color=#8080ff size=2>static</B></FONT><FONT size=2>
</FONT><B><FONT color=#8080ff size=2>final</B></FONT><FONT size=2> String
PARAMETER_FILE_NAME = </FONT><FONT color=#2a00ff
size=2>"TEMPLATEFILE"</FONT><FONT size=2>;</P>
<P><STRONG><FONT color=#8080ff></FONT></STRONG><STRONG><FONT
color=#8080ff></FONT></STRONG><STRONG><FONT
color=#8080ff></FONT></STRONG><STRONG><FONT
color=#8080ff></FONT></STRONG><STRONG><FONT
color=#8080ff></FONT></STRONG></FONT><STRONG><FONT
color=#8080ff></FONT></STRONG>
<P><FONT color=#3f5fbf size=2></P></FONT><FONT size=2></FONT><B><FONT
color=#8080ff size=2>public</B></FONT><FONT size=2> </FONT><B><FONT
color=#8080ff size=2>byte</B></FONT><FONT size=2>[] getContent(CmsObject
cms,String templateFile,String elementName,Hashtable theParameters,String
templateSelector)</P>
<P></FONT><B><FONT color=#8080ff size=2>throws</B></FONT><FONT size=2>
CmsException</P>
<P>{</P></FONT><FONT size=2>
<P>String jspTemplateFileName = (String) theParameters.get(elementName +
</FONT><FONT color=#2a00ff size=2>"."</FONT><FONT size=2> +
PARAMETER_FILE_NAME);</P>
<P></FONT><B><FONT color=#8080ff size=2>if</B></FONT><FONT size=2>
(jspTemplateFileName == </FONT><B><FONT color=#8080ff
size=2>null</B></FONT><FONT size=2> || </FONT><FONT color=#2a00ff
size=2>""</FONT><FONT size=2>.equals(jspTemplateFileName))</P>
<P>{</P>
<P>jspTemplateFileName = JSP_TEMPLATE;</P>
<P>}</P>
<P></FONT><B><FONT color=#8080ff size=2>try</P></B></FONT><FONT size=2>
<P>{</P>
<P>OpenCms oCms = OpenCms.getInstance();</P>
<P>CmsFile file = oCms.getCmsFile(cms, jspTemplateFileName);</P>
<P></FONT><B><FONT color=#8080ff size=2>if</B></FONT><FONT size=2> (file !=
</FONT><B><FONT color=#8080ff size=2>null</B></FONT><FONT size=2>)</P>
<P>{</P>
<P>CmsXmlTemplateFile templateDocument =</P>
<P>getOwnTemplateFile(cms, templateFile, elementName, theParameters,
templateSelector);</P>
<P>Enumeration eD =
templateDocument.getAllSubElementDefinitions().elements();</P></FONT><FONT
size=2>
<P></FONT><B><FONT color=#8080ff size=2>while</B></FONT><FONT size=2>
(eD.hasMoreElements())</P>
<P>{</P>
<P>String eName = (String) eD.nextElement();</P>
<P>String s = templateDocument.getParameter(eName, PARAMETER_FILE_NAME);</P>
<P>HttpServletRequest req = (HttpServletRequest)
cms.getRequestContext().getRequest().getOriginalRequest();</P>
<P></P>
<P>CmsFile tempFile = oCms.getCmsFile(cms, s);</P>
<P></P>
<P></FONT><B><FONT color=#8080ff size=2>int</B></FONT><FONT size=2> launcherId =
tempFile.getLauncherType();</P>
<P>String startTemplateClass = file.getLauncherClassname();</P>
<P>I_CmsLauncher launcher =
cms.getLauncherManager().getLauncher(launcherId);</P>
<P>CmsJspLoader j = (CmsJspLoader)launcher ;</P>
<P>String jspName = j.getJspUri(s, </FONT><B><FONT color=#8080ff
size=2>false</B></FONT><FONT size=2>);</P>
<P>req.setAttribute(eName, jspName);</P>
<P>HttpSession ssn = req.getSession();</P>
<P>ssn.setAttribute(eName, jspName); //Also tryied session to see if this
works</P>
<P></FONT><FONT size=2>}</P></FONT><FONT size=2>
<P>oCms.setResponse(cms, file);</P>
<P>oCms.showResource(cms, file);</P>
<P>}</P>
<P>} </FONT><B><FONT color=#8080ff size=2>catch</B></FONT><FONT size=2>
(IOException e)</P>
<P>{</P>
<P>} </FONT><B><FONT color=#8080ff size=2>catch</B></FONT><FONT size=2>
(CmsException e)</P>
<P>{</P>
<P>}</P>
<P>String s = </FONT><FONT color=#2a00ff size=2>""</FONT><FONT size=2>;</P>
<P></FONT><B><FONT color=#8080ff size=2>return</B></FONT><FONT size=2>
s.getBytes();</P>
<P>}</P>
<P>}</P></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2>In JSP I have following line </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><% String screenJsp =
(String)session.getAttribute("screenJsp");
<BR>System.out.println(screenJsp);<BR>%></FONT></DIV>
<DIV><FONT face=Arial size=2><jsp:include page="<%= screenJsp %>"
flush="true" /> <BR></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>What I am trying to do is.</FONT></DIV>
<DIV><FONT face=Arial size=2>Define a Master JSP template with include tag
like defined above. Create a OpenCMS Element template file. The element template
will have ELEMENTDEF defined for each jsp include tag with a Paramenter having
the value of Path to JSP file.</FONT></DIV>
<DIV><FONT face=Arial size=2>In JSPTemplate class I will read name of Elemendef
and Template file paratmeter and save in Attribute collection of request of
Session object. I will read values of each include file in the JSP master
template and set the values, Like this I can get a JSP file prepared for
rendering.</FONT></DIV>
<DIV><FONT face=Arial size=2>This will provide template support to
JSP.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I don't know how good I explained this situation
but If you have my Velocity template doc, that will help, because I am trying to
do this in samilar way.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Regards</FONT></DIV>
<DIV><FONT face=Arial size=2>Anil Patel</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=alex@opencms.org href="mailto:alex@opencms.org">Alexander
Kandzior</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=opencms-dev@www.opencms.org
href="mailto:opencms-dev@www.opencms.org">opencms-dev@www.opencms.org</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, August 12, 2002 12:09
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> AW: [opencms-dev] Flex Session
variable</DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><BR></DIV>
<DIV><SPAN class=356210807-12082002><FONT face=Arial color=#0000ff size=2>Hi
Anil,</FONT></SPAN></DIV>
<DIV><SPAN class=356210807-12082002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=356210807-12082002><FONT face=Arial color=#0000ff size=2>I
can, but I need more information. Some example code would
help.</FONT></SPAN></DIV>
<DIV><SPAN class=356210807-12082002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=356210807-12082002><FONT face=Arial color=#0000ff size=2>Best
Regards,</FONT></SPAN></DIV>
<DIV><SPAN class=356210807-12082002><FONT face=Arial color=#0000ff
size=2>Alex</FONT></SPAN></DIV>
<DIV><SPAN class=356210807-12082002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=356210807-12082002><FONT face=Arial color=#0000ff
size=2>Alexander Kandzior</FONT></SPAN></DIV>
<DIV><SPAN class=356210807-12082002><FONT face=Arial color=#0000ff
size=2>OpenCms Group / Alkacon Software</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=de dir=ltr align=left><FONT face=Tahoma
size=2>-----Ursprüngliche Nachricht-----<BR><B>Von:</B> <A
href="mailto:owner-opencms-dev@www.opencms.org">owner-opencms-dev@www.opencms.org</A>
[mailto:owner-opencms-dev@www.opencms.org] <B>Im Auftrag von </B>Anil K
Patel<BR><B>Gesendet:</B> Montag, 12. August 2002 07:40<BR><B>An:</B>
opencms-dev@www.opencms.org<BR><B>Betreff:</B> [opencms-dev] Flex Session
variable<BR><BR></FONT></DIV>
<DIV><FONT face=Arial size=2>I am having problems in reading session
variable in JSP. It the return value is null. Can somebody help me in
understanding the issue</FONT></DIV>
<DIV><FONT face=Arial
size=2>Anil</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>