aspose file tools
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

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSON At in servlet" Watch "JSON At in servlet" New topic

JSON At in servlet

Sonu Sen

Joined: Jun 03, 2009
Posts: 17

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

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

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

Joined: Jan 10, 2002
Posts: 63037

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]
subject: JSON At in servlet
It's not a secret anymore!