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?
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.