• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Token session Problem

 
vik ar
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I have some functionality in my site which allows a member to login and logout of their account. When the user clicks the logout link the following code is executed to destroy the session

I have stepped through in debug and this code executes fine. However when an attempt is made to display the resulting page I get the following error

When I take the following code out of the resulting jsp the error does not happen.

I am guessing this issue is being caused by the token (which I am using to prevent double submits). To get around this I am thinking of not using the token and instead introducing some javascript to disable the button once its been clicked. I know if the client has js turned off there is a chance of double submit, but the functionality is read only on the db, so I am not too concerned. However at the same time it feels like a fudge and would like to understand and fix the issue correctly. Over to you
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're trying to invalidate the session then turn around and use it--pick one.
 
vik ar
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
then i will use js for search functionality. cheers
 
Shriram Pandit
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David /Vik I am also getting the same error

SEVERE: Error creating HttpSession due response is commited to client. You can use the CreateSessionInterceptor or create the HttpSession from your action before the result is rendered to the client: getAttribute: Session already invalidated
java.lang.IllegalStateException: getAttribute: Session already invalidated
at org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1165)
at org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:122)
at org.apache.struts2.dispatcher.SessionMap.get(SessionMap.java:163)
at org.apache.struts2.dispatcher.SessionMap.put(SessionMap.java:181)
at org.apache.struts2.util.TokenHelper.setToken(TokenHelper.java:71)
at org.apache.struts2.components.Token.buildToken(Token.java:114)

Please guide me . As I didnot understand the answer you gave to Vik

Really Appreciate the help.

Note: I am also using Token Session interceptor in my code and getting this error while loggin out on call of getServletRequest().getSession().invalidate();
 
Shriram Pandit
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David understood what you said.

Thanks Now error is not getting displayed becuase of removal of <s:token/> from result page

Really appreciate it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic