• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

session is not setting attribute for few Users

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are running a web application wherein I am setting an attribute in session on first jsp page i.e session.setAttribute("homeFlag","YES");

Now when user migrates to second page I am checking if the session value is "YES" using following code in my Action class.

String homeFlag = (String)session.getAttribute("homeFlag");
System.out.println("homeFlag==="+homeFlag);
if(!homeFlag.equals("YES")){
mapping.findForward("homePage");
}

Its working well for around 90% Users but for remaining Users homeFlag value is always NULL.
Could you please help me in resolving this issue.

Thanks in Advance!
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most application servers rely on cookies for HTTPSession management. If some of your users have disabled cookies in their browsers, this may account for this problem. You may want to check with these users to see if they have disabled or restricted cookies.
 
vaibhav maddiwar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your response!

Could you tell me any solution for this problem without actually going to User's machine and enabling the cookie.
Is there any way that session object created by us should not use cookie.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd suggest you check your application server's documentation for how to turn on URL rewriting. This is another technique for session management that doesn't rely on cookies.
 
vaibhav maddiwar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Merrill,

Thanks for giving the hint.

I have updated my weblogic.xml with following

<session-descriptor>
<session-param>
<param-name>URLRewritingEnabled</param-name>
<param-value>True</param-value>
</session-param>
<session-param>
<param-name>CookiesEnabled</param-name>
<param-value>False</param-value>
</session-param>
</session-descriptor>

and seems like my application is using URL rewriting because I could see "jsessionId" got appended to my URL.

Thanks a lot!
 
reply
    Bookmark Topic Watch Topic
  • New Topic