Meaningless Drivel is fun!*
The moose likes JSP and the fly likes JSON At in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSON At in servlet" Watch "JSON At in servlet" New topic
Author

JSON At in servlet

Sonu Sen
Greenhorn

Joined: Jun 03, 2009
Posts: 17
Hi,

I am generating a JSON String at client side that is in JSP page and send to the server means to servlet. And I catch that string in the servlet using getParameter(). But I cant access the single element from that JSON string in the servlet.Please tell me How can servlet reterive the single element from the String.

Eg. {"Iem1":"3","Item2":"4","Item3":"12"}

then I want only 3. How can I get that 3.
Guogang Fan
Greenhorn

Joined: Aug 17, 2009
Posts: 7
you can parse the String yourself with those String functions defined in java.lang.String.
or you can use some Java library to do it
www.json.orghave introduced many java api to handle json .
Guogang Fan
Greenhorn

Joined: Aug 17, 2009
Posts: 7
you can also parse the Json String at client side then send the server what you need.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

Why are you creating a JSON string at all if that's not what you need?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSON At in servlet
 
Similar Threads
Passing the JSON Array to the servlet
JSON response to populate listbox
Post Does not Return new Values
Help Modifying Servlet Please
i want to create a file in the server from the client? is it possible?