0

I am developing an application which load jsp page in webview.It send the parametres to the jsp oage using Post method.I am creating a string of parameter & passing to post method like this

w1.postUrl(protocol +"://"+host_ip+":"+portnumber+"/"+FOLDER+"/folder/data.jsp", EncodingUtils.getBytes(params, "BASE64"));

params="?username="+uname+"&password="+password;

Now i have two questions

  1. Do i need to pass the '?' in params for POST method if i don't pass '?' then i get error.
  2. I get value null for password
fvu
  • 32,488
  • 6
  • 61
  • 79
Tarun Sharma
  • 601
  • 3
  • 13
  • 31

1 Answers1

1

Use an HttpPost object to set the paramters:

    DefaultHttpClient httpClient = new DefaultHttpClient();
    HttpPost httpPost = new HttpPost(blobUploadURL);
    String param="param";
    httpPost.setParameter("parameter, param);
    try {
        HttpResponse response = httpClient.execute(httpPost);
        statusCode = response.getStatusLine().getStatusCode();
    }
Price
  • 2,683
  • 3
  • 17
  • 43
  • but i am sending post param from webview – Tarun Sharma Dec 17 '14 at 12:07
  • Check these questions: http://stackoverflow.com/questions/9373103/http-post-response-into-webview-in-android http://stackoverflow.com/questions/13452289/how-to-make-post-requests-with-webview – Price Dec 17 '14 at 12:14