Results 1 to 4 of 4
- 03-28-2012, 03:09 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 3
- Rep Power
- 0
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...");
}
%>
- 03-28-2012, 03:29 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
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.
- 03-29-2012, 11:59 AM #3
Member
- Join Date
- Mar 2012
- Posts
- 3
- Rep Power
- 0
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
- 04-02-2012, 11:11 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Similar Threads
-
Accessing ModelAttribute Object in Javascript
By ali_sakar in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 01-16-2012, 11:28 AM -
Can't access Object of JavaScript
By scsvel in forum New To JavaReplies: 2Last Post: 06-28-2011, 07:11 AM -
problem d'insertion
By haykel9 in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 05-04-2010, 11:11 AM -
query on object insertion
By alesa in forum Advanced JavaReplies: 0Last Post: 04-11-2010, 05:20 PM -
Insertion Problem
By balaji csc in forum Web FrameworksReplies: 0Last Post: 12-08-2009, 03:26 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks