[opencms-dev] State shared between the JSPs

Georgi Naplatanov gosho at oles.biz
Wed Jan 23 12:09:20 CET 2013


Hi Karri.

Managing session's attributes works just fine with OpenCms, check that 
session managing code in your JSP is at the top of the JSP file and 
there are no HTML tags or white spaces before that code.

Best regards
Georgi

On 01/23/2013 12:16 PM, Karri Sankar Rao wrote:
>
>
> 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"
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>



More information about the opencms-dev mailing list