Hi,

It was my mistake I was refering to the wrong Action
class in my struts.xml

Please find my observations with regard to the portlet
session handling

1) I implemented the SessionAware interface and it's
method setSession and add the session attributes, This
works with no issues

2) in the Action class's execute method I did the
following

Map session = (Map)
ActionContext.getContext().get("session");
session.put("myId","This is myID");

This works fine


3) I tried the following in the execute method 

RenderRequest req =
PortletActionContext.getRenderRequest();
        
        
        PortletSession
session1=req.getPortletSession();
        session1.setAttribute("myId","my Test Id ew");


This works as well.



Summary is all above works and I could retrieve them
from the jsp which means it works as expected similar
to the normal struts 2.0.6 application.


Thanks





--- Nils-Helge Garli <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> This is probably a missing feature in the portlet
> framework. The
> SessionAware interface aparently doesn't work when
> inside a portlet.
> The other approach you use should work, but if it
> doesn't, try using
> the ActionContext to get the session map and put it
> there.
> 
> Nils-H
> 
> On 3/16/07, tom tom <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I implemented the following interface
> >
> > org.apache.struts2.interceptor.SessionAware;
> >
> > hence implemented the
> >
> > public void setSession(Map session) method and did
> add
> > the following attribute
> >
> > session.put("NAME","USER1");
> >
> > and in my jsp I have the following
> >
> > <s:property value="#session.NAME"/> <br>
> >
> > It works fine in a normal struts Web Application.
> >
> > But when I did the same in a Portlet Application,
> the
> > jsp does not print the value. Should I do any
> > additional steps, I was under the impression we
> can
> > write a portlet as similar to a web application.
> >
> > After that I tried the following
> >
> >  RenderRequest req =
> > PortletActionContext.getRenderRequest();
> >
> >  PortletSession session1=req.getPortletSession();
> >  session1.setAttribute("NAME","USER1");
> >
> >
> > but still jsp does not print the session values.
> >
> >
> > Can some one let me know how to proceed ont this.
> >
> >
> > thanks
> >
> >
> >
> >
> >
> >
> > --- Nate Drake <[EMAIL PROTECTED]> wrote:
> >
> > > Have your action implement SessionAware, and
> give it
> > > a setter of the form:
> > >
> > > public void setSession(Map session);
> > >
> > > You can then add things to this map, and they
> will
> > > be added into the session.
> > > Then you can access them in your JSP like this:
> > >
> > > <s:property value="#session\['NAME'\]"/>
> > >
> > >
> > > See these pages for more details:
> > >
> > >
> >
>
http://struts.apache.org/2.0.6/docs/how-do-we-get-access-to-the-session.html
> > >
> >
>
http://struts.apache.org/2.0.6/docs/application-session-request-objects-in-jsp.html
> > >
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > >
> > >
> >
> >
> >
> >
> >
>
____________________________________________________________________________________
> > Expecting? Get great news right away with email
> Auto-Check.
> > Try the Yahoo! Mail Beta.
> >
>
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



 
____________________________________________________________________________________
Looking for earth-friendly autos? 
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to