<!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>I know that current version of JSP in OpenCMS does
not have all this, I am trying to do this thing, So that I can write all my
templates for generating HTML code in JSP instead of CDATA section in Good
old OpenCMS style.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Code of Master template I am using for
JSP.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><?xml
version="1.0"?><BR><XMLTEMPLATE><BR><ELEMENTDEF
name="elementjsp"><BR><TEMPLATE>/content/elements/jspelement</TEMPLATE><BR><CLASS>com.aditisoft.opencms.templates.JSPTemplate</CLASS><BR><PARAMETER
name="TEMPLATEFILE"><BR>/flexdemo/index.html<BR></PARAMETER><BR></ELEMENTDEF><BR><TEMPLATE>
<BR><ELEMENT name="elementjsp"/>
<BR></TEMPLATE><BR></XMLTEMPLATE></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>code in element template pointed by following URL
of ELEMENTDEF in above template</FONT></DIV>
<DIV><FONT face=Arial
size=2><TEMPLATE>/content/elements/jspelement</TEMPLATE>
</FONT></DIV>
<DIV><FONT face=Arial size=2>file is </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><?xml
version="1.0"?><BR><XMLTEMPLATE><BR><VELOCITYELEMENT><BR><PROCESS>jsp_code</PROCESS><BR></VELOCITYELEMENT><BR><TEMPLATE><BR><PROCESS>VELOCITYELEMENT</PROCESS><BR></TEMPLATE></FONT></DIV>
<DIV><FONT face=Arial size=2><ELEMENTDEF
name="screenJsp"></FONT></DIV><FONT face=Arial size=2>
<DIV><!-- The two lines below does not have any use
--><BR><TEMPLATE>/content/elements/JSPElementA</TEMPLATE><BR><CLASS>com.aditisoft.opencms.templates.JSPTemplate</CLASS></DIV>
<DIV><PARAMETER
name="TEMPLATEFILE"><BR>/flexdemo/howto.html<BR></PARAMETER><BR></ELEMENTDEF></FONT></DIV>
<DIV><FONT face=Arial size=2></XMLTEMPLATE></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>MAIN JSP Pointed by following parameter of
"elementjsp" ElementDef in Master template </DIV>
<DIV><PARAMETER
name="TEMPLATEFILE"><BR>/flexdemo/index.html<BR></PARAMETER><BR></DIV>
<DIV>Simplefied code of JSP, </DIV>
<DIV> </DIV>
<DIV>This line "<% String screenJsp =
(String)request.getAttribute("screenJsp"); %> " can be </DIV>
<DIV><% String screenJsp = (String)session.getAttribute("screenJsp"); %>
</DIV>
<DIV>depending on where the value "screenJsp" is set, I will prefer to use
request object.</DIV>
<DIV> </DIV>
<DIV>------ MAIN JSP CODE pointed
by--/flexdemo/index.html-----------------------------------------------------------------------------</DIV>
<DIV> </DIV>
<DIV><% String screenJsp = (String)request.getAttribute("screenJsp");
%></DIV>
<DIV><html></DIV>
<DIV><head><BR></head></DIV>
<DIV><body bgcolor="#ffffff"></DIV>
<DIV><table cellspacing="0" width="100%" cellpadding="0"
border="0"><BR> <tr><BR> <td valign="top"
bgcolor="#ffffff"><BR> <jsp:include
page="<%= screenJsp %>" flush="true" /> <BR>
</td><BR> </tr><BR></table></DIV>
<DIV></body></DIV>
<DIV></html></DIV>
<DIV> </DIV>
<DIV>---------------------------------------------JSP CODE
END-----------------------------------</DIV>
<DIV> </DIV>
<DIV>Now using the MASTER Template defined in first part of mail, We can create
a PAGE in OpenCMS Old Style. When I click in this page, Request is processed and
finally </DIV>
<DIV>to process following line in MASTER TEMPLATE</DIV>
<DIV> </DIV>
<DIV><TEMPLATE> <BR><ELEMENT name="elementjsp"/>
<BR></TEMPLATE><BR></DIV>
<DIV>request comes to JSPTemplate class given in my previous mail. This
JSPTemplate class , reads the parameter declared in ELEMENTDEF of and get the
URI of JSP that will act as Main TEMPLATE file for the page. This JSP can
have multiple include statements, for filling different sections in the page,
Like the Sample JSP. </DIV>
<DIV>After JSPTemplate class knows the URI of main JSP, We also read the
Template file of the Element, Cotents of this file can have one or more
ELEMENTDEF. Information from these ELEMENTDEFs can be used for filling the
include JSP URI places. For convention we can have ELEMENTDEF name same as the
name of the variable used in Main JSP. The template file part of elementdef in
this section is not used. we also provide a PARAMETER with name
TEMPLATEFILE, this PARAMETER's value is the URI of JSP that will
be used as include in the main JSP.</DIV>
<DIV> </DIV>
<DIV>Code that does this work in JspTemplate class </DIV>
<DIV>
<P><B><FONT color=#8080ff size=2>while</B></FONT><FONT size=2>
(eD.hasMoreElements())</FONT></P>
<P><FONT size=2>{</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></FONT></DIV>
<DIV>}</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>If I am able to set the names of names of include files in JSP
dynamically, this will Give us power to Write Application wide Main template in
JSP and define individual sections like HEAD section, NAV section and other
sections, using JSP. </DIV>
<DIV> </DIV>
<DIV>This will mean Independence from CDATA. I was very excited initially but
some silly mistake of mine has suppressed all that.</DIV>
<DIV> </DIV>
<DIV>I appriciate your interest, I hope you will not lose your interest in this
problem because of cummunication problem. In case you still have any more
queries please write to me. </DIV>
<DIV> </DIV>
<DIV>Regards</DIV>
<DIV>Anil Patel</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR> </DIV></FONT>
<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 8:34
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [opencms-dev] Flex Session
variable</DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT
face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><BR></DIV>
<DIV><SPAN class=163301603-13082002><FONT face=Arial color=#0000ff
size=2>Anil,</FONT></SPAN></DIV>
<DIV><SPAN class=163301603-13082002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=163301603-13082002><FONT face=Arial color=#0000ff size=2>I
still do not fully understand what you are trying to do. Can you please also
include the code of the XMLTemplates with the ElementDefs?
</FONT></SPAN></DIV>
<DIV><SPAN class=163301603-13082002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=163301603-13082002><FONT face=Arial color=#0000ff
size=2>I do not see in what context your JSPTemplate class gets
called. Since it extends CmsXmlTemplate is (obviously) seems to be called from
a XMLTemplate. So you would have a XMLTemplate that includes a JSP element, a
function that is not included in the current Flex alpha 1 release. Is it that
what you are trying to do?</FONT></SPAN></DIV>
<DIV><SPAN class=163301603-13082002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=163301603-13082002><FONT face=Arial color=#0000ff
size=2>Regards,</FONT></SPAN></DIV>
<DIV><SPAN class=163301603-13082002><FONT face=Arial color=#0000ff
size=2>Alex.</FONT></SPAN></DIV>
<DIV><SPAN class=163301603-13082002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=163301603-13082002><FONT face=Arial color=#0000ff
size=2>Alexander Kandzior</FONT></SPAN></DIV>
<DIV><SPAN class=163301603-13082002><FONT face=Arial color=#0000ff
size=2>OpenCms Group / Alkacon Software</FONT></SPAN></DIV>
<DIV><SPAN class=163301603-13082002><FONT face=Arial color=#0000ff
size=2></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>-----Original Message-----<BR><B>From:</B>
owner-opencms-dev@www.opencms.org [mailto:owner-opencms-dev@www.opencms.org]
<B>On Behalf Of </B>Anil K Patel<BR><B>Sent:</B> Monday, August 12, 2002
9:56 AM<BR><B>To:</B> opencms-dev@www.opencms.org<BR><B>Subject:</B> Re:
[opencms-dev] Flex Session variable<BR><BR></FONT></DIV>
<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>
<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></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>