Tarun Sharma
Tarun Sharma

Reputation: 599

Passing params in Post method for webview

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

Upvotes: 0

Views: 1336

Answers (1)

Price
Price

Reputation: 2703

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();
    }

Upvotes: 1

Related Questions