关于网友提出的“ 如何得到返回值的问题。”问题疑问,本网通过在网上对“ 如何得到返回值的问题。”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: 如何得到返回值的问题。描述:
response.sendRedirect("http://www.dxqf.net/softweb/login.asp?username=10000035& password =135a");
response没有返回值,但是我又要得到返回值该怎么写?或者是换一种方式也可以。
解决方案1:
HttpClient
HttpClient httpClient = new HttpClient();
String URL2 ="http://www.dxqf.net/softweb/login.asp";
method = new PostMethod(URL);
method.addParameter("username", "10000035");
method.addParameter("password ", "135a");
int statusCode = httpClient.executeMethod(method);
if(statusCode == HttpStatus.SC_OK){
String isok = method.getResponseBodyAsString();
System.out.println(isok );
}