[opencms-dev] State shared between the JSPs

Carlos Gonzalez carlos.gonzalez at sagasoluciones.com
Wed Jan 23 13:11:34 CET 2013


Try with:
<%@ page buffer="none" session="true" <------ 

 
----------------mensaje original-----------------
De: "Karri Sankar Rao" sankarrao.k at sonata-software.com 
Para: "The OpenCms mailing list" opencms-dev at opencms.org 
Fecha: Wed, 23 Jan 2013 11:40:14 +0000
-------------------------------------------------
 
 
> Hi Georgi,
> 
> Thanks for your reply. Here is my code:
> 
> session.setAttribute("whitePaperRegistrationMailId",regDetails.getEm
> ailId());
> String mailId = 
> (String)session.getAttribute("whitePaperRegistrationMailId");
> out.println("Mail id is :"+mailId); //This is working fine in same JSP.
> 
> When I am trying to access from another JSP with the below code, I am getting null 
> value.
> String mailId = 
> (String)session.getAttribute("whitePaperRegistrationMailId");
> out.println("Mail id is :"+mailId); //I am getting null value.
> 
> I think the problem is with OpenCMS.
> 
> Thanks,
> Sankar.K
> 
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org ] On Behalf Of Georgi Naplatanov
> Sent: Wednesday, January 23, 2013 4:39 PM
> To: The OpenCms mailing list
> Subject: Re: [opencms-dev] State shared between the JSPs
> 
> 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
>>
>>
>>
> _______________________________________________
> 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
> 
> 
> 
> 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
> 
> 
> 
> 

-- 

 
[www.sagasoluciones.com 
 
www.templatesaga.com 
 
www.facebook.com/sagasoluciones -> ../../../../../] 


 

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, contiene información de carácter confidencial exclusivamente dirigida a su destinatario o destinatarios. Queda prohibida su divulgación, copia o distribución a terceros sin la previa autorización escrita de SaGa Consulting. En el caso de haber recibido este correo electrónico por error, se ruega notifíquese inmediatamente esta circunstancia mediante reenvío a la dirección electrónica del remitente.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
The information in this e-mail and in any attachments is confidential and solely for the attention and use of the named addressee(s). You are hereby notified that any dissemination, distribution or copy of this communication is prohibited without the prior written consent of SaGa Consulting. If you have received this communication in error, please, notify the sender by reply e-mail.

 

P Antes de imprimir este mensaje, asegúrate de que es necesario. El medio ambiente está en nuestras manos. 
P Wasting paper is harmful to the enviroment. Please consider that before printing this message.




More information about the opencms-dev mailing list