This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session invalidation - getModel called from JSP?

 
Santosh Sb
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a struts 2 application that takes credit card and ach payments. The application is ModelDriven, all the data entered on the screens are saved in a domain model that's in session.

The requirement is that once the payment service has been called successfully, the session should be invalidated and then the user be shown the confirmation screen with confirmation number and other details.

Problem is, in the last action class which loads the confirmation screen, I invalidate the session, and then route to the JSP. But the JSP for some reason calls the getModel method on the action which tries to load the domain object from session. Since the session is already invalidated, I am getting something like java.lang.IllegalStateException: getAttribute: Session already invalidated. On the browser, I see a Stream is already closed exception.

Looking at the stacktrace, there are a few <s:text tags on the JSP that inturn call the getModel. Why is the s:text calling getModel?

Can the gurus please point out if I am missing something, or doing something wrong? Thanks bunches!
 
Ankit Garg
Sheriff
Posts: 9509
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Santosh, welcome to javaranch.

Can you show us the code of your JSP page. Right now there isn't enough information to guess what the problem is...
 
Santosh Sb
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for responding Ankit.

This is action class that does session invalidation




The Base Action class has getModel method that loads the domain model from session into the action classes. I added the try catch block in the getModel method otherwise the JSP throws the IllegalStateException error



The JSP uses s:getText to display dynamic text either from Action class attributes or from the resource bundle



It blows up right on the first s:text

Any ideas? Thanks again!
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Santosh Gyrations wrote:
The JSP uses s:getText to display dynamic text either from Action class attributes or from the resource bundle



As far as I know, s:text can load text from resources only, you'd have to use s:property, for instance, to display strings from your action class.

Are you sure that getModel() is called because of the s:text tags..?
 
Santosh Sb
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Lorand. I will post the exception stack trace tomorrow, but I pretty sure somewhere in there I saw the s.text call from the jsp page.

Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic