Michael- setAttribute takes 2 parameters 1stis String, 2nd is Object setAttribute(String,Object)
http://www.bluesunrise.com/portlet-api/javax/portlet/PortletSession.html HTH Martin ______________________________________________ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. > Date: Wed, 22 Oct 2008 17:10:47 +0200 > From: [EMAIL PROTECTED] > To: pluto-user@portals.apache.org > Subject: Sharing session between portlet and servlet > > Hey, I've a problem to share session data from a portlet with an servlet (in > a other context). > > An example, in portlet1 i put (or try to put) an attribute into the > httpsession: > > PortletSession ps = > PortletActionContext.getRequest().getPortletSession(true); > String poco = (String)ctx.getAttribute("poco"); > if (poco == null) { > System.out.println("poco == null!"); > ps.setAttribute("poco", ""+1); > } else { > int newLoco = Integer.parseInt(loco); > newLoco++; > ps.setAttribute("poco", ""+newLoco); > System.out.println("poco rules: "+newLoco); > } > I also tried to use the overloaded method of setAttribute > (ps.setAttribute("poco", ""+1, PortletSession.APPLICATION_SCOPE) and > ps.setAttribute("poco", ""+1, PortletSession.PORTLET_SCOPE)) without success. > > In a servlet, i try to read out my http session (HttpSession sess = > request.getSession(true) ...) but I never find my variable poco in the http > session. The only thing that worked was using the portletcontext: > > PortletContext ctx = PortletActionContext.getPortletContext(); > String poco ... > > But in this case, the scope of the session variable was just portlet-wide > (portlet wide=all portlets, which are in the same .war file / defined in > portlet.xml). > > Some more information about my env.: > > I'm using: > - springframework 2.0.8 > - struts 2.0.11.2 > - pluto 1.1.6 > - hibernate 3.2.1.ga > > Tomcat v6.0.14 > > Server.xml > <Connector port="500" maxHttpHeaderSize="8192" > maxThreads="150" minSpareThreads="25" maxSpareThreads="75" > enableLookups="false" redirectPort="14443" acceptCount="100" > connectionTimeout="20000" disableUploadTimeout="true" > emptySessionPath="true" /> > > <Context path="/customer" > docBase="c:/whatever/blah/" > crossContext="true" /> > > > cheers > > > Michael Vogt > Solution Engineer > > United Security Providers AG > Bahnhofstrasse 4 > Postfach > CH-3073 Gümligen > _________________________________________________________________ You live life beyond your PC. So now Windows goes beyond your PC. http://clk.atdmt.com/MRT/go/115298556/direct/01/