You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Michael Boss <ba...@googlemail.com> on 2006/08/27 20:24:57 UTC

Session problem

Hi All,

I have two Portlets. One transfers data to another. For example I
transfer attribute "name":

PortletSession session = request.getPortletSession();
String name = "TestName";
session.setAttribute("mf_name", name,PortletSession.PORTLET_SCOPE);

And another portlet receives this attribute:

PortletSession session = request.getPortletSession();
String name = (String) session.getAttribute("mf_name",
PortletSession.APPLICATION_SCOPE);
System.out.println("Name: "+name); Here I receive null (name=null).

What is wrong? What I do incorrectly?

Many thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: Session problem

Posted by Ate Douma <at...@douma.nu>.
Michael Boss wrote:
> Hi All,
> 
> I have two Portlets. One transfers data to another. For example I
> transfer attribute "name":
> 
> PortletSession session = request.getPortletSession();
> String name = "TestName";
> session.setAttribute("mf_name", name,PortletSession.PORTLET_SCOPE);
> 
> And another portlet receives this attribute:
> 
> PortletSession session = request.getPortletSession();
> String name = (String) session.getAttribute("mf_name",
> PortletSession.APPLICATION_SCOPE);
> System.out.println("Name: "+name); Here I receive null (name=null).
> 
> What is wrong? What I do incorrectly?
Please don't cross-post to both user and developer lists.
I, and probably most or even all other subscribers to the developer list are subscribed to the user list too!

Now, for your problem:
you use the wrong scope (PORTLET_SCOPE) for setting the attribute, use APPLICATION_SCOPE.

> 
> Many thanks
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


RE: Session problem

Posted by Susheel Choudhari <sc...@serenecorp.com>.
Michael,
 
Try setting the session attribute with APPLICATION_SCOPE.

Hope this helps you.

Thanks

Susheel


________________________________

From: Michael Boss [mailto:baron.muenhausen@googlemail.com]
Sent: Sun 8/27/2006 11:24 AM
To: jetspeed-user@portals.apache.org; jetspeed-dev@portals.apache.org
Subject: Session problem



Hi All,

I have two Portlets. One transfers data to another. For example I
transfer attribute "name":

PortletSession session = request.getPortletSession();
String name = "TestName";
session.setAttribute("mf_name", name,PortletSession.PORTLET_SCOPE);

And another portlet receives this attribute:

PortletSession session = request.getPortletSession();
String name = (String) session.getAttribute("mf_name",
PortletSession.APPLICATION_SCOPE);
System.out.println("Name: "+name); Here I receive null (name=null).

What is wrong? What I do incorrectly?

Many thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org




Re: Session problem

Posted by Michael Boss <ba...@googlemail.com>.
Hallo Martin, Hallo Ate,

Many thanks for the help! :)
It works :))

2006/8/27, Martin Dulisch <md...@gmail.com>:
> Hi Michael,
>
> you call setAttribute with Portlet_scope attribute. You should set the
> attribute also in application_scope. May be this solves the problem.
>
> Martin
>
>
> 2006/8/27, Michael Boss <ba...@googlemail.com>:
> > Hi All,
> >
> > I have two Portlets. One transfers data to another. For example I
> > transfer attribute "name":
> >
> > PortletSession session = request.getPortletSession();
> > String name = "TestName";
> > session.setAttribute("mf_name", name,PortletSession.PORTLET_SCOPE);
> >
> > And another portlet receives this attribute:
> >
> > PortletSession session = request.getPortletSession();
> > String name = (String) session.getAttribute("mf_name",
> > PortletSession.APPLICATION_SCOPE);
> > System.out.println("Name: "+name); Here I receive null (name=null).
> >
> > What is wrong? What I do incorrectly?
> >
> > Many thanks
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
> > For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: Session problem

Posted by Martin Dulisch <md...@gmail.com>.
Hi Michael,

you call setAttribute with Portlet_scope attribute. You should set the
attribute also in application_scope. May be this solves the problem.

Martin


2006/8/27, Michael Boss <ba...@googlemail.com>:
> Hi All,
>
> I have two Portlets. One transfers data to another. For example I
> transfer attribute "name":
>
> PortletSession session = request.getPortletSession();
> String name = "TestName";
> session.setAttribute("mf_name", name,PortletSession.PORTLET_SCOPE);
>
> And another portlet receives this attribute:
>
> PortletSession session = request.getPortletSession();
> String name = (String) session.getAttribute("mf_name",
> PortletSession.APPLICATION_SCOPE);
> System.out.println("Name: "+name); Here I receive null (name=null).
>
> What is wrong? What I do incorrectly?
>
> Many thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org