[opencms-dev] Flex Session variable
Alexander Kandzior
alex at opencms.org
Tue Aug 13 05:34:21 CEST 2002
Anil,
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?
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?
Regards,
Alex.
Alexander Kandzior
OpenCms Group / Alkacon Software
-----Original Message-----
From: owner-opencms-dev at www.opencms.org
[mailto:owner-opencms-dev at www.opencms.org] On Behalf Of Anil K Patel
Sent: Monday, August 12, 2002 9:56 AM
To: opencms-dev at www.opencms.org
Subject: Re: [opencms-dev] Flex Session variable
Alex,
What I am trying to do is bit of Hack, I am trying to do Templating with
JSP that you have provided.
public class JSPTemplate extends CmsXmlTemplate
{
static final String JSP_TEMPLATE = "/flexdemo/default.jsp";
static final String PARAMETER_FILE_NAME = "TEMPLATEFILE";
public byte[] getContent(CmsObject cms,String templateFile,String
elementName,Hashtable theParameters,String templateSelector)
throws CmsException
{
String jspTemplateFileName = (String) theParameters.get(elementName +
"." + PARAMETER_FILE_NAME);
if (jspTemplateFileName == null || "".equals(jspTemplateFileName))
{
jspTemplateFileName = JSP_TEMPLATE;
}
try
{
OpenCms oCms = OpenCms.getInstance();
CmsFile file = oCms.getCmsFile(cms, jspTemplateFileName);
if (file != null)
{
CmsXmlTemplateFile templateDocument =
getOwnTemplateFile(cms, templateFile, elementName, theParameters,
templateSelector);
Enumeration eD =
templateDocument.getAllSubElementDefinitions().elements();
while (eD.hasMoreElements())
{
String eName = (String) eD.nextElement();
String s = templateDocument.getParameter(eName, PARAMETER_FILE_NAME);
HttpServletRequest req = (HttpServletRequest)
cms.getRequestContext().getRequest().getOriginalRequest();
CmsFile tempFile = oCms.getCmsFile(cms, s);
int launcherId = tempFile.getLauncherType();
String startTemplateClass = file.getLauncherClassname();
I_CmsLauncher launcher =
cms.getLauncherManager().getLauncher(launcherId);
CmsJspLoader j = (CmsJspLoader)launcher ;
String jspName = j.getJspUri(s, false);
req.setAttribute(eName, jspName);
HttpSession ssn = req.getSession();
ssn.setAttribute(eName, jspName); //Also tryied session to see if this
works
}
oCms.setResponse(cms, file);
oCms.showResource(cms, file);
}
} catch (IOException e)
{
} catch (CmsException e)
{
}
String s = "";
return s.getBytes();
}
}
In JSP I have following line
<% String screenJsp = (String)session.getAttribute("screenJsp");
System.out.println(screenJsp);
%>
<jsp:include page="<%= screenJsp %>" flush="true" />
What I am trying to do is.
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.
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.
This will provide template support to JSP.
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.
Regards
Anil Patel
----- Original Message -----
From: Alexander <mailto:alex at opencms.org> Kandzior
To: opencms-dev at www.opencms.org
Sent: Monday, August 12, 2002 12:09 AM
Subject: AW: [opencms-dev] Flex Session variable
Hi Anil,
I can, but I need more information. Some example code would help.
Best Regards,
Alex
Alexander Kandzior
OpenCms Group / Alkacon Software
-----Ursprüngliche Nachricht-----
Von: owner-opencms-dev at www.opencms.org
[mailto:owner-opencms-dev at www.opencms.org] Im Auftrag von Anil K Patel
Gesendet: Montag, 12. August 2002 07:40
An: opencms-dev at www.opencms.org
Betreff: [opencms-dev] Flex Session variable
I am having problems in reading session variable in JSP. It the return
value is null. Can somebody help me in understanding the issue
Anil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20020813/540028e7/attachment.htm>
More information about the opencms-dev
mailing list