Reputation: 2794
I am sendin post request from jquery like this :
$.ajax({
type: "POST",
url: "Save",
data: { conr: conr ,expiry : expiry,settings : settings}
inside servlet , i am able to get parameters (conr , expiry , settings)
but the problem is that
the settings
parameter contains serialized form data : like this :
high=true&ci=false&title=qTip+as+Button+Menu&private=true&[email protected]
I know that i can use string tokenizer
to get data but i want to make sure that- if their is any simple way or not?
Upvotes: 0
Views: 352
Reputation: 23913
You could use the HttpComponents and let URLEncodedUtils
parse it for you.
So you could just invoke URLEncodedUtils.parse(yourString,Charset.forName("UTF-8"))
and you receive as return a List<NameValuePair>
containing name and value associated elements. In this case something like: hight = "true", title = "qTip as Button Menu" and so on. And this all with the right decoded.
Upvotes: 1
Reputation: 10103
You can also use split on the settings string with "&" as a regex.
Upvotes: 0