WebSphere Application Server - Losing HtpSession variabled

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Application Server > May 2005 > Losing HtpSession variabled





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Losing HtpSession variabled

2005-05-21, 5:50 pm

HI ppl,
I am setting some sesison variables, but when I am trying to retrieve them on the same server in the same application, they are null.
I have checked in admin console, cookies are enabled.
I am setting it in Struts action, and retreiving in another struts action.
HttpSession sess = request.getSession();
sess.setAttribute("name","john");

HttpSession sess = request.getSession();
sess.getAttribute("name");

Any ideas what is wrong or missing in configuration.
I am using WAS 6.





Ken Hygh

2005-05-21, 5:50 pm

am_gandhi@hotmail.com wrote:

>HI ppl,
> I am setting some sesison variables, but when I am trying to retrieve them on the same server in the same application, they are null.
> I have checked in admin console, cookies are enabled.
> I am setting it in Struts action, and retreiving in another struts action.
> HttpSession sess = request.getSession();
> sess.setAttribute("name","john");
>
> HttpSession sess = request.getSession();
> sess.getAttribute("name");
>
>Any ideas what is wrong or missing in configuration.
>I am using WAS 6.
>
>
>
>
>
>
>

The code you've posted should work just fine. I suspect that there's
something you're not showing us. For instance, if sess is declared
outside a method, you've got a problem.

Ken

2005-05-22, 7:47 am

OK ppl,
I figured out there is a setting in admin console for urlEncode.
Now its working for all the jsp links but when ever I encode a url for struts action, its not working.
I encode it like
<html:link href="/ivr/path.do"> click </html:link>

After encoding link looks like

<a href="/ivr/path. do;jsessionid=0000tZXVwS8DE8W9jsZHoacHKM
5:-1">click</a>

Now when I click on this link websphere is saying

Invalid path ;jsessionid=0000tZXVwS8DE8W9jsZHoacHKM5:
-1 was requested

Is there anything missing?

please advice..

thanks in advance

Ray McVay

2005-05-22, 5:49 pm

am_gandhi@hotmail.com wrote:
> OK ppl,
> I figured out there is a setting in admin console for urlEncode.
> Now its working for all the jsp links but when ever I encode a url for struts action, its not working.
> I encode it like
> <html:link href="/ivr/path.do"> click </html:link>
>
> After encoding link looks like
>
> <a href="/ivr/path. do;jsessionid=0000tZXVwS8DE8W9jsZHoacHKM
5:-1">click</a>
>
> Now when I click on this link websphere is saying
>
> Invalid path ;jsessionid=0000tZXVwS8DE8W9jsZHoacHKM5:
-1 was requested
>
> Is there anything missing?
>
> please advice..
>
> thanks in advance
>

Struts has tags for situations where you need to rewrite URLs. I'd
recommend you check out the Manning book, Struts Recipes.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com