Working on the ShopprStream(earlier known as WEB122) has helped me get acquainted with many facets of web-development.
Now I have a Java method that returns a generic HashMap object ;
For this example lets consider that the key is of type String
The DWR call will return a JSON object. This is how we can access the dat
for (var key in hashMap)
{
//if not using Firebug, comment out console.log statements
//'key' is the key in the HashMap
console.log("key : "+ key);
//this will give the no. of elements stored corresponding to the 'key'
console.log("hashMap[key].length: "+ hashMap[key].length);
//Access individual elements corresponding to the 'key'
for(var i=0; i<hashMap[key].length; i++)
{
console.log("hashMap[key][i].name: " + hashMap[key][i].name);
}
}
If the HashMap contains custom objects, make sure it has a corresponding converter entry in the dwr.xml file
Here, abc.xyz is the package structure
If object returned is hashmap
hasMap[key]
hasMap[key][0],