File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

erasing bean from scope

 
Baba Bizlowsky
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

Is there a quick way to invalidate a bean? I understand that <jsp:setProperty> tag leaves everything as it were if I send in the null-values. But what if I want to erase the data from the bean (e.g. when the user is signing out)? Is invalidating the session the only way?

Thanks in advance. Cheers!
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is HttpSession.removeAttribute.
You could also create your own clearProperties method which empties all of the properties in the bean.
If the bean implements HttpSessionBindingListener, you could have the method called automatically when the object is removed from session.

You could also wrap the clearProperties method with a plain setter or getter and call it from your jsp with a jsp:setProperty or jsp:getProperty tag.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic