File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Portals and Portlets and the fly likes HOw to get session variables between portlets ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "HOw to get session variables between portlets ?" Watch "HOw to get session variables between portlets ?" New topic
Author

HOw to get session variables between portlets ?

kala sagar
Greenhorn

Joined: Feb 25, 2010
Posts: 7
HI all,

i am using gridsphere portlet container 2.2.10 and deployed pure JSR 168 portlets. I need to use user name and password which i entered in login portlet in JSR 168 portlet.for that i set a session variables userName and Password . But oin JSR 168 Portlet it's displaying value "null" .
To invoke JSR 168 container is using one servlet PortletInvoker.java .How can i do it.? please help me. Thanks in advance.


sagar
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
Hi Kala,

can you please post code you tried?


Thanks,
Shailesh
kala sagar
Greenhorn

Joined: Feb 25, 2010
Posts: 7
Hi

how can i post all grid sphere container code. It's a nearly 20mb file and having many java files .If you need my JSR 168 portlet then i will send .


Thanks and Regards
sagar
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
only required code from portlet which is giving problem...
kala sagar
Greenhorn

Joined: Feb 25, 2010
Posts: 7
Hi,


in container i set session.setAttribute("userName",req.getParameter("username"));

in my JSR 168 portlet i am trying to get session.getAttribute("userName");

this value is coming "null"

pelase help me


Thanks and Regards
sagar
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
Hi Sagar,

session.setAttribute("userName",req.getParameter("username"), PortletSession.APPLICATION_SCOPE);

try this...

get more in from HERE
kala sagar
Greenhorn

Joined: Feb 25, 2010
Posts: 7
If i am adding that APPLICATION_SCOPE it's giving error


compilation error.
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
Post your full portlet java file.
jsut want to see source with imports of classes.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HOw to get session variables between portlets ?
 
Similar Threads
Choosing Page Flow Portlets or Java Portlets - Weblogic
Inter-Portlet Communication
New to Portlet
Query on JSR 168 Struts portlet
is there any difference between portlet and portlets