2 Replies Latest reply: Nov 24, 2011 10:38 AM by Satyendra Sharma RSS

Difference between request.getAttribute, session.getAttribute


Difference between request.getAttribute, session.getAttribute?

  • 1. Re: Difference between request.getAttribute, session.getAttribute
    prakash chandra roy Newbie

    request.getAttribute  function will be availabe to the servlet till it get response from the server .thus its  life cycle will exist till the one who call the this function get response.on the other hand session.getAttribute function will be available to the servlet till the user get logout.When the user get login from that moment the session of the user get started and througout his login period session.getAttribute will work.

  • 2. Re: Difference between request.getAttribute, session.getAttribute
    Satyendra Sharma Newbie

    1.request.getAttribute gives object added to the request and will be available only for that request made. After one complete cycle of request and response its values will be lost.

    2. session.getAttribute keeps objetc alive till session expire that were set by session.setAttribute.

    3. object set in a request will not be available for other user while value set in session will be available to other user and other user can get Object through session.getAttribute.