Results 1 to 4 of 4
  1. #1
    umadatt is offline Member
    Join Date
    Mar 2012
    Posts
    3
    Rep Power
    0

    Default Getting problem in dynaming insertion in object in javascript

    Hi,
    I am getting problem in storing data in object having key/value pairs.
    Pls suggest me about the below code what changes r required.
    Thanks
    Umadatt

    var data=[];

    <%
    System.out.println("Error 1..." + menuMaster.size());
    if (menuMaster != null) {
    System.out.println("Error 2...");
    for (int i = 0; i < menuMaster.size(); i++) {
    MenuMasterBean flatDetail = (MenuMasterBean) menuMaster.get(i);



    System.out.println("flatDetail.getStatus()"+flatDe tail.getStatus());
    %>




    data["id"] = <%=flatDetail.getMenuid()%>;
    alert(data["id"]);
    data["text"]= <%=flatDetail.getMenuname()%>;
    <% if(flatDetail.getParentname()!=null){%>
    data["parentid"]=<%=flatDetail.getParentname()%>;
    <%}else{%>
    data["parentid"]="-1";
    alert(data.length);

    <%}





    System.out.println("Error 3..." + i);
    }%>

    <% }

    else
    {
    System.out.println("Error 4...");
    }

    %>

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    18

    Default Re: Getting problem in dynaming insertion in object in javascript

    What problem are you encountering?
    Any errors?
    Things it should be doing but isn't?
    Please do not ask for code as refusal often offends.

  3. #3
    umadatt is offline Member
    Join Date
    Mar 2012
    Posts
    3
    Rep Power
    0

    Default Re: Getting problem in dynaming insertion in object in javascript

    Hi,
    Thanks for the reply,
    Actually I need to store values in an Object (an associative array) where Id,parentid,text as keys according to these keys multiple values to be stored which i have got in jsp scriplet.for static storage we are using
    var data=[
    {
    "id":"fgdf",
    "text":"sdsdf",
    "parentid":"33"
    }, and so on
    Pls provide me help related to dynamically how will maintain

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    18

    Default Re: Getting problem in dynaming insertion in object in javascript

    I gathered that, but you haven't said what problem you are having with the code in your original post.

    Also, when posting code please use [code] tags[/code].
    Please do not ask for code as refusal often offends.

Similar Threads

  1. Accessing ModelAttribute Object in Javascript
    By ali_sakar in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 01-16-2012, 11:28 AM
  2. Can't access Object of JavaScript
    By scsvel in forum New To Java
    Replies: 2
    Last Post: 06-28-2011, 07:11 AM
  3. problem d'insertion
    By haykel9 in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 05-04-2010, 11:11 AM
  4. query on object insertion
    By alesa in forum Advanced Java
    Replies: 0
    Last Post: 04-11-2010, 05:20 PM
  5. Insertion Problem
    By balaji csc in forum Web Frameworks
    Replies: 0
    Last Post: 12-08-2009, 03:26 PM

Tags for this Thread

Posting Permissions

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