struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Heidy Gutiérrez Guzmán" <heidyg...@gmail.com>
Subject Re: Erase Only some Session Objests and variables
Date Mon, 25 Sep 2006 21:12:39 GMT
You can use this code:

   Enumeration enumeration = session.getAttributeNames();
   while (enumeration.hasMoreElements()) {
    String element = (String) enumeration.nextElement();
       session.removeAttribute(element);
   }

If yo don't have delete any element, you can do this:

   Enumeration enumeration = session.getAttributeNames();
   while (enumeration.hasMoreElements()) {
    String element = (String) enumeration.nextElement();
    if(!element.matches("notDeleteElement") )
        session.removeAttribute(element);
   }

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message