表单把用户名 密码 等信息提交到main.py mian.py处理
mian.py经过处理后 把信息交给login.jsp 判断是否是合法用户 form表单信息如下<form name=form1 action="main/main.py" method=post>
<input type=hidden value=chinese name=LANUAGE>
<input type=hidden value=login.jsp name=jsp> <table width="200" border="0" align="center" cellpadding="0" cellspacing="0" background="images/entry.gif">
<tr>
<td valign="top">
<table width="100%" height="91" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="30%" height="18"> 用户名:</td>
<td width="70%" height="25">
<input name="username" type="text" style="border:1px solid #6788AF;width:115;height:18;font-size:12px" size="32">
</td>
</tr>
<tr>
<td height="9"> 密 码:</td>
<td height="16">
<input type="password" name="password" style="border:1px solid #6788AF;width:115;height:18;font-size:12px">
</td>我写的程序 如下
HttpClient client = new HttpClient(); client.getHostConfiguration().setHost(LOGON_SITE, LOGON_PORT,"http");
//client.getHostConfiguration().setHost("10.0.10.105", 25);
//模拟登录页面login.jsp->main.jsp PostMethod post = new PostMethod("main/main.py");//提交密码用户名的地址 NameValuePair username = new NameValuePair("username", "xxf");
NameValuePair password = new NameValuePair("password", "222");
NameValuePair jsp = new NameValuePair("jsp", "login.jsp");
NameValuePair lanuage = new NameValuePair("LANUAGE", "chinese");
post.setRequestBody(new NameValuePair[]{username,password,jsp,lanuage});
int status = client.executeMethod(post);
System.out.println(post.getResponseBodyAsString()); post.releaseConnection(); //访问所需的页面main2.jsp GetMethod get = new GetMethod("/main/main.py"); client.executeMethod(get); System.out.println(get.getResponseBodyAsString()); get.releaseConnection(); }
一直报错 请各位帮我看看
mian.py经过处理后 把信息交给login.jsp 判断是否是合法用户 form表单信息如下<form name=form1 action="main/main.py" method=post>
<input type=hidden value=chinese name=LANUAGE>
<input type=hidden value=login.jsp name=jsp> <table width="200" border="0" align="center" cellpadding="0" cellspacing="0" background="images/entry.gif">
<tr>
<td valign="top">
<table width="100%" height="91" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="30%" height="18"> 用户名:</td>
<td width="70%" height="25">
<input name="username" type="text" style="border:1px solid #6788AF;width:115;height:18;font-size:12px" size="32">
</td>
</tr>
<tr>
<td height="9"> 密 码:</td>
<td height="16">
<input type="password" name="password" style="border:1px solid #6788AF;width:115;height:18;font-size:12px">
</td>我写的程序 如下
HttpClient client = new HttpClient(); client.getHostConfiguration().setHost(LOGON_SITE, LOGON_PORT,"http");
//client.getHostConfiguration().setHost("10.0.10.105", 25);
//模拟登录页面login.jsp->main.jsp PostMethod post = new PostMethod("main/main.py");//提交密码用户名的地址 NameValuePair username = new NameValuePair("username", "xxf");
NameValuePair password = new NameValuePair("password", "222");
NameValuePair jsp = new NameValuePair("jsp", "login.jsp");
NameValuePair lanuage = new NameValuePair("LANUAGE", "chinese");
post.setRequestBody(new NameValuePair[]{username,password,jsp,lanuage});
int status = client.executeMethod(post);
System.out.println(post.getResponseBodyAsString()); post.releaseConnection(); //访问所需的页面main2.jsp GetMethod get = new GetMethod("/main/main.py"); client.executeMethod(get); System.out.println(get.getResponseBodyAsString()); get.releaseConnection(); }
一直报错 请各位帮我看看
解决方案 »
- 极简单的问题:参数中的Class<?>是什么意思?
- NoClassDefFoundError错误,我在JSP中调用这个方法可以执行,但是用java命令来执行就出现了这个错误,不知奥什么原因
- Java中有没有办法访问相对上级目录!
- 一个未完整的程序,谁帮忙补完整了,送100分
- Q币悬赏+40分(把adsl的主页的html文件下载保存到本地?)
- 文件传输问题!
- 如何启动多个虚拟机?
- 关于eclipse+ant的问题
- 如何将某个Jbutton设为缺省按钮!
- servlet中out.println()输出的东西是不是存到response对象中了
- 新手上路,请大家进来帮忙看一个很简单的程序编译不通过的问题。
- 求助一道for,switch,while的笔试题
Exception in thread "main" java.net.UnknownHostException: http://mail.trasin.net
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:240)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at testhttp.Main.main(Main.java:46)
Java Result: 1
也许是DNS解析,防火墙,代理,访问权限之类的问题喵