[opencms-dev] State shared between the JSPs
Karri Sankar Rao
sankarrao.k at sonata-software.com
Wed Jan 23 11:16:05 CET 2013
Hi,
I am working on OpenCMS application. I am new to OpenCMS.
I have one object which I want to keep it in session so that I can use it in other JSPs.
I tried in 2 ways to get this.
a) Initially I used JSP implicit variable i.e session.setAttribute("someObj",someObj). But this session object is not available in other JSPs. I am getting null when I try to retrieve using session.getAttribute("someObj");
b) Then I used another approach.
CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response);
final CmsObject cmsObject = cms.getCmsObject();
final CmsRequestContext requestContext = cmsObject.getRequestContext();
requestContext.setAttribute("someObj ", someObj);
I am not sure whether it is in request scope or session scope. When I tried to access it in another JSP, getting null value.
CmsJspActionElement cms=new CmsJspActionElement(pageContext, request, response);
final CmsObject cmsObject = cms.getCmsObject();
final CmsRequestContext requestContext = cmsObject.getRequestContext();
Object obj = requestContext.getAttribute("someObj ");
Could you please let me know how to resolve this.
Your help is highly appreciated.
Thanks,
Sankar.K
Disclaimer: "The materials contained in this email and any attachments may contain confidential or legally privileged information. The information contained in this communication is intended solely for the use of the individual or entity to whom it is addressed and others authorized to receive it. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system. Sonata is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20130123/5fe8f40f/attachment.htm>
More information about the opencms-dev
mailing list