Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Open Source Projects
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
paul wheaton
Sheriffs:
Ron McLeod
Devaka Cooray
Henry Wong
Saloon Keepers:
Tim Holloway
Stephan van Hulst
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Frits Walraven
Forum:
Other Open Source Projects
how to, JSON data
Pradeep Adibatla
Ranch Hand
Posts: 336
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I have a hashMap ,HMap1 which contains 3 values...
How to prepare this as JSON and use it in
jsp
??
This statement tells me that I have 1 value in my map
!!!
System.out.println("The val is :--> "+atrHMap1.toString().trim());
I did like this...
JSONObject jsonObject = JSONObject.fromObject( atrHMap1 ); System.out.println("The array Vals are :--> "+jsonObject );
I use the plugin jsonplugin-0.32.jar...
This jar should be ok or something else should be used??
It doesn't print anything?? what could it be? and how do I use this in my Javascript...
Pradeep Adibatla
Ranch Hand
Posts: 336
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I converted like this,it worked with a different plugin though...
JSONObject json = new JSONObject(atrHMap1); String out=json.toString(); System.out.println("out is :--> "+out);
Now in JS I have...
if(xmlhttp.readyState==4) { alert(xmlhttp.responseText); // json 'out' to be used... var selectBox = document.getElementById('act'); //id of the select box alert("select box is :--> "+selectBox); selectBox.innerHTML = xmlhttp.responseText; // I want that 'out' into this selectBox !!!
how do I use that json
string
in the above code??
I also have this in struts.xml
<package name="default" extends="json-default" > <action name="cules" class="CulesModelAction" > <result type="json"> <param name="root">jsonData</param> </result> </action> </package>
Though it is struts2 ,the core issue lies with JS and hence the post here... thanks!
Ruth Stout was famous for gardening naked. Just like this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
iterate doubt
JSONObject from two packages
JSON+Jquery
Struts2 mapping query
json+struts2
More...