Results 1 to 2 of 2

Thread: sessions

  1. #1
    Join Date
    Jun 2010
    Posts
    25
    Rep Power
    0

    Default sessions

    hi ,

    could you explain me how we can set session attributes and how we can retrieve those values in other page.

    HttpSession hs = req.getSession(true);

    what is the use of above line.

    and if req.getSession(false);what will happen.


    in one action class i am getting the list values from DB and i am settinng list values into session like below.

    hs.setAttribute("list",list);

    then in another jsp page i need to retrieve this list.for this simply if we give like below means

    List sample=hs.getAttribute("list"); now is it list values will come?

    or we need to check again HttpSession hs = req.getSession(true);
    then after only will get.

    please suggest me in this
    Thanks&Regards,
    Muralikrishna K

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default

    Quote Originally Posted by murali23krishna View Post
    hi ,

    could you explain me how we can set session attributes and how we can retrieve those values in other page.

    HttpSession hs = req.getSession(true);

    what is the use of above line.

    and if req.getSession(false);what will happen.
    The API is your friend.

    Quote Originally Posted by murali23krishna View Post
    in one action class i am getting the list values from DB and i am settinng list values into session like below.

    hs.setAttribute("list",list);

    then in another jsp page i need to retrieve this list.for this simply if we give like below means

    List sample=hs.getAttribute("list"); now is it list values will come?

    or we need to check again HttpSession hs = req.getSession(true);
    then after only will get.

    please suggest me in this
    That's not how you get session attributes in a JSP.
    That's what the usebean tag is for.

Similar Threads

  1. Sessions
    By Billywizz in forum New To Java
    Replies: 1
    Last Post: 03-28-2011, 08:53 PM
  2. sessions doubt
    By anilarava in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 11-16-2010, 01:22 PM
  3. Kill sessions
    By Subscribe.name in forum Java Servlet
    Replies: 1
    Last Post: 10-05-2009, 10:22 PM
  4. Sessions in jsp
    By Ed in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 07-02-2007, 03:46 PM
  5. sessions in jsp
    By Heather in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 06-30-2007, 03:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •