Store data at the client-side using jsp/servlets

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ale
    New Member
    • Oct 2007
    • 11

    Store data at the client-side using jsp/servlets

    can anyone plzzz tell how to store data at the client side using jsp's or servlets?
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Do not use words such as 'Plzzz', 'help' and 'urgent' in your thread title. They don't make your question more likely to be answered. If anything, it's less likely to be looked at.

    Can you give more information about the kind of data that you want to store? Post your code using code tags.

    JavaScript cannot store data in a database (if that's what you mean), but you can use Ajax to make a request to a server-side script (in this case, a JSP servlet) to do it for you.

    Comment

    • dmjpro
      Top Contributor
      • Jan 2007
      • 2476

      #3
      Originally posted by acoder
      Do not use words such as 'Plzzz', 'help' and 'urgent' in your thread title. They don't make your question more likely to be answered. If anything, it's less likely to be looked at.

      Can you give more information about the kind of data that you want to store? Post your code using code tags.

      JavaScript cannot store data in a database (if that's what you mean), but you can use Ajax to make a request to a server-side script (in this case, a JSP servlet) to do it for you.
      I think he is talking abut client side data, it may be Cookie :-)

      Kind regards,
      Dmjpro.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by dmjpro
        I think he is talking abut client side data, it may be Cookie
        Well, if it is a cookie, then try this link.

        Comment

        • Ale
          New Member
          • Oct 2007
          • 11

          #5
          Originally posted by acoder
          Well, if it is a cookie, then try this link.
          Is it possible using arrays or arraylists at the client side??

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5388

            #6
            hi ...

            what do you mean exactly with that? in scripts you may use arrays, objects wherever you want ... and i think you could store them in a cookie too ... you would need to have a json-like string that you store in a cookie ... when you reread the cookie-value you may eval it and you will have the array, object, or whatever back in your script ...

            kind regards

            Comment

            • Ale
              New Member
              • Oct 2007
              • 11

              #7
              Originally posted by gits
              hi ...

              what do you mean exactly with that? in scripts you may use arrays, objects wherever you want ... and i think you could store them in a cookie too ... you would need to have a json-like string that you store in a cookie ... when you reread the cookie-value you may eval it and you will have the array, object, or whatever back in your script ...

              kind regards

              hey hii...


              i am new to JS...can u xplain me tht wid an example...how can u xactly store the data using arrays at the client side??

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5388

                #8
                hi ...

                have a look at post #4 there you find a link with an example on how to use cookies.

                now we set the value of the cookie to something like this:

                [CODE=javascript]var cookie_value = '[1, 2, 3]';
                [/CODE]
                when you read this value out of the cookie you may do:

                [CODE=javascript]var reread_cookie_v alue = eval(cookie_val ue);
                [/CODE]
                and reread_cookie_v alue now contains a javascript-array [1, 2, 3]

                kind regards

                Comment

                Working...