about storing vales in sessions


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: about storing vales in sessions

  1. #1
    satish Guest

    about storing vales in sessions




    in session tracking we have methods tod store and retrieve values from session
    object..In my program I am storing all the individual products selected by
    the user in a session object
    using session.putvalue("cart.items", prodselected[i]), but in the next servlet
    i need to retrive all the values individually stored by the user in the session
    object, so for this

    we have session.getValue("cart.items") - it retrieves only one(the recent
    stored value), and session.getValueNames();;;but i want to retrive all the
    values and there is no method such as

    session.getvalues("cart.items")..so how do i do it,


    if anyone understood the problem pls help me

    satish

  2. #2
    KK Guest

    Re: about storing vales in sessions


    satish,

    You should be storing the entire *prodselected* array.

    session.putvalue("cart.items", prodselected)

    and use (Object[])session.getValue("cart.items") to get it.

    --KK

    "satish" <satish141@england.com> wrote:
    >
    >
    >
    >in session tracking we have methods tod store and retrieve values from session
    >object..In my program I am storing all the individual products selected

    by
    >the user in a session object
    >using session.putvalue("cart.items", prodselected[i]), but in the next servlet
    >i need to retrive all the values individually stored by the user in the

    session
    >object, so for this
    >
    >we have session.getValue("cart.items") - it retrieves only one(the recent
    >stored value), and session.getValueNames();;;but i want to retrive all the
    >values and there is no method such as
    >
    >session.getvalues("cart.items")..so how do i do it,
    >
    >
    >if anyone understood the problem pls help me
    >
    >satish



  3. #3
    SATISH Guest

    Re: about storing vales in sessions



    Dear KK,


    Thanks for ur response...my problem is solved with your answer..

    satish


  4. #4
    Fernando Ribeiro Guest

    Re: about storing vales in sessions


    You should store a data structure in the session object able to handle all
    that. An instance of java.io.ArrayList would perform great but as far as
    I can remember a class must implement the Serializable interface in order
    to be bound to the session object. Take a look at the documentation available
    and check it out.

    Anyway all you would need to do is to mark your class "serializable" since
    no methods need to be written in order to implement that interface.

    Hope that helps.

    fribeiro

    "KK" <kaykay@rayr.com> wrote:
    >
    >satish,
    >
    >You should be storing the entire *prodselected* array.
    >
    >session.putvalue("cart.items", prodselected)
    >
    >and use (Object[])session.getValue("cart.items") to get it.
    >
    >--KK
    >
    >"satish" <satish141@england.com> wrote:
    >>
    >>
    >>
    >>in session tracking we have methods tod store and retrieve values from

    session
    >>object..In my program I am storing all the individual products selected

    >by
    >>the user in a session object
    >>using session.putvalue("cart.items", prodselected[i]), but in the next

    servlet
    >>i need to retrive all the values individually stored by the user in the

    >session
    >>object, so for this
    >>
    >>we have session.getValue("cart.items") - it retrieves only one(the recent
    >>stored value), and session.getValueNames();;;but i want to retrive all

    the
    >>values and there is no method such as
    >>
    >>session.getvalues("cart.items")..so how do i do it,
    >>
    >>
    >>if anyone understood the problem pls help me
    >>
    >>satish

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center