Storing values on clientside


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Storing values on clientside

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Posts
    17

    Storing values on clientside

    Hi,

    Can u tell me how to store the values that are retrieved from the serverside on the clientside

    For ex i retrieved values from database using JSP and i want to store them in a Java script array so that they can be used afterwards for clientside working.

    Thanks in advance
    subhakar

  2. #2
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    255
    Set it as a request attribute and retrieve it in the JSP. It will be some jugglery of scriptlets and javascript.

    Here's a snippet which might give you an idea.
    Code:
    <%
        List dbList = (List)request.getAttribute("somereqparam");
    %>
    
    <script>
    var jsArray = new Array();
    
    // Somewhere in the script code
    <% for(int i = 0; i < dbList.size(); i++) { %>
    jsArray[<%=i%>] = "<%=dbList.get(i).toString()%>";
    <% } %>
    </script>
    Happiness is good health and a bad memory.

Similar Threads

  1. Need Help Storing Data in MySQL
    By nctarheelsc in forum Database
    Replies: 1
    Last Post: 05-10-2005, 04:33 PM
  2. storing access table values in arrays in Vb
    By vbcoder in forum VB Classic
    Replies: 1
    Last Post: 04-14-2005, 06:39 AM
  3. Form Values Unchanged
    By Faisal in forum ASP.NET
    Replies: 0
    Last Post: 03-08-2003, 04:59 AM
  4. STORING IDENTITY VALUES
    By sheryl kemp in forum Database
    Replies: 1
    Last Post: 03-19-2002, 08:55 AM
  5. losing Form values from option boxes
    By Paul Klanderud in forum ASP.NET
    Replies: 2
    Last Post: 07-26-2000, 10:13 AM

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