0

I am working on client-server application in java, (converting some code from java-script). I am struck. In java i am sending values to server by embedding in namevaluepairs. But after putting values i am getting empty json in java, which is working in javascript (values sending via GET using web forms ).

Here it javascript form statement:

<input type="text" name="criteria" value= 'Email=="wei.wang_zh@pcstars.com"'>

and here is java namevaluepair statement in which i am getting issue:

nameValuePairs.add(new BasicNameValuePair("criteria", "'Email==\"wei.wang_zh@pcstars.com\"'"));

I have tried to put string in a String data type, which is also not working. Here it is

String val="wei.wang_zh@pcstars.com";
    nameValuePairs.add(new BasicNameValuePair("criteria", "'Email==\""+val+"\"'"));

Please let me know what mistake i'm doing in both cases. Thanks

Saif
  • 6,804
  • 8
  • 40
  • 61
user2393171
  • 365
  • 1
  • 3
  • 6
  • 1
    if you are passing those name value pair as part of a GET request,you need to url encode the value first! Also how are you sending the GET request.Please show us the complete code – Anirudha Feb 24 '15 at 08:57
  • Anirudha, Dear there is no issue in the server sending part. I am getting results if i use simple "Email=---" (email without special characters) but the zoho server has 'Email=="wei.wang_zh@pcstars.com"' sent me method (If i include special characters in email) – user2393171 Feb 24 '15 at 09:06

1 Answers1

0

I am not sure how you are sending the params to server but I think answer provided in following link may help

https://stackoverflow.com/a/4660576/4600335

nameValuePairs.add(new BasicNameValuePair("criteria", "'Email==\"wei.wang_zh@pcstars.com\"'"));

String paramString = URLEncodedUtils.format(nameValuePairs, "utf-8");

url += paramString;
Community
  • 1
  • 1
Amit Sadafule
  • 431
  • 5
  • 15