struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john lee <sh_thorn_b...@yahoo.com>
Subject struts 2 session question
Date Wed, 08 May 2013 16:15:00 GMT
 
for stuts 1, to get session, via the following
 
      session=request.getSession();
      session.setAttribute("PERSON", person);    /* person is object name */
 
for struts 2, to get session, via the following
 
      Map session=ActionContext.getContext().getSession();
      session.put("PERSON", person);    /* person is object name */
 
question is
   
    for struts2: if i use the following
          session.setAttribute("PERSON", person);    
    then compile to get following error
            
               cannot find symbol
                       symbol  : method setAttribute(java.lang.String,neuco.Person)
                        location: interface java.util.Map
                        session.setAttribute
 
   is that means for struts2, when i use session, i have to use session.put, but session.setAttribute
is no longer valid?
   what is the difference b/w session.put and session.setAttribute?
 
thanks in advance
 
john
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message