setAttribute
public void setAttribute(java.lang.String name,
java.lang.Object value)
Binds an object to this session, using the name specified. If an object of the same name is already bound to the session, the object is replaced.
After this method executes, and if the new object implements HttpSessionBindingListener, the container calls HttpSessionBindingListener.valueBound. The container then notifies any HttpSessionAttributeListeners in the web application.
If an object was already bound to this session of this name that implements HttpSessionBindingListener, its HttpSessionBindingListener.valueUnbound method is called.
If the value passed in is null, this has the same effect as calling removeAttribute().
Parameters:
name - the name to which the object is bound; cannot be null
value - the object to be bound
Throws:
java.lang.IllegalStateException - if this method is called on an invalidated session