主题:帮我把java转换代码成 javabean
[em1]
高手帮我把这个JAVA转成javabean
package test;
import java.io.IOException;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
public class SampleHttpClient {
public static void main(String[] args) throws IOException
{
HttpClient client = new HttpClient();
client.getHostConfiguration().setHost("www.hpedi.com.cn", 80, "http");
HttpMethod method = getPostMethod();//使用POST方式提交数据
client.executeMethod(method);
//打印服务器返回的状态
System.out.println(method.getStatusLine());
//打印结果页面
String response =
new String(method.getResponseBodyAsString().getBytes("8859_1"));
//打印返回的信息
System.out.println(response);
method.releaseConnection();
}
/**
* 使用POST方式提交数据
*/
private static HttpMethod getPostMethod(){
PostMethod post = new PostMethod("/index.aspx");
NameValuePair txtComCode = new NameValuePair("txtComCode","4401290508");
NameValuePair txtUserId = new NameValuePair("txtUserId","0021");
NameValuePair txtPassword = new NameValuePair("txtPassword","14521452");
post.setRequestBody(new NameValuePair[] { txtComCode,txtUserId,txtPassword});
return post;
}
}
无限感激!!
高手帮我把这个JAVA转成javabean
package test;
import java.io.IOException;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
public class SampleHttpClient {
public static void main(String[] args) throws IOException
{
HttpClient client = new HttpClient();
client.getHostConfiguration().setHost("www.hpedi.com.cn", 80, "http");
HttpMethod method = getPostMethod();//使用POST方式提交数据
client.executeMethod(method);
//打印服务器返回的状态
System.out.println(method.getStatusLine());
//打印结果页面
String response =
new String(method.getResponseBodyAsString().getBytes("8859_1"));
//打印返回的信息
System.out.println(response);
method.releaseConnection();
}
/**
* 使用POST方式提交数据
*/
private static HttpMethod getPostMethod(){
PostMethod post = new PostMethod("/index.aspx");
NameValuePair txtComCode = new NameValuePair("txtComCode","4401290508");
NameValuePair txtUserId = new NameValuePair("txtUserId","0021");
NameValuePair txtPassword = new NameValuePair("txtPassword","14521452");
post.setRequestBody(new NameValuePair[] { txtComCode,txtUserId,txtPassword});
return post;
}
}
无限感激!!