Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Session values lost  RSS feed

 
Pan Igor
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a strange issue with FEW USERS ONLY. I set some values in the session object in the JSP and when I try to read those values in the actionhandler, I am getting NULL. Anyone encountered this problem? I am using struts.

In JSP ->
session.setAttribute("name", myObject);

In ActionHandler ->
HttpSession mySession = request.getSession();
MyObject obj = (MyObject)mySession.getAttribute("name");

Just before I set the values in the object, I am printing the values in JSP & all the values are fine. But values in actionhandler are NULL for few users only.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose the ActionHandler is invoked in a new request following to the logic in your JSP.

I would guess these 'few' user disabled cookies and your web application is not designed to support url rewriting as a fallback.
 
Pan Igor
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose the ActionHandler is invoked in a new request following to the logic in your JSP.
--> actionhandler is invoked from the JSP so it is a new request. but i am storing the data in the session & hence should be able to access those values anytime unless the session has expired (which it hasnt)


I would guess these 'few' user disabled cookies and your web application is not designed to support url rewriting as a fallback.
--> what has cookie to do with session value? how are they related? I can certainly check with these users abt that. How do i make my web app support url rewriting? can this resolve my prob?
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does the Server know that 2 separate requests come from one and the same user ?
It stores a cookie that holds a unique session ID, that is transmitted with every request, this way the container can assign the session to the corresponding request.

If the user disables cookies, the only way to enforce session management is to fall back to URL rewriting. In that case the session id is appended to the url whenever a resource is requested.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!