JAVA代码实现POST数据到指定网址(下班前结贴)
有jsp如下:
<html>
<head>
<script type="text/javascript">
function postData(){
form1.action = "http://WWW.XXXXXXXX.COM";
document.form1.submit();
}
</script>
<title>
Test
</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift-JIS" />
</head>
<body>
<form id="form1" name="form1" method="post" onsubmit="postData();">
<table border="0">
<tr>
<td><input name="N01" id="N01" value="20043" /></td>
</tr>
<tr>
<td align="center"><input type=submit name='doTest' value='TEST' /></td>
</tr>
</table>
</form>
</body>
</html>
功能很简单,就是把几个字段值POST到某个网址,然后转到该网页继续执行相关操作。
现在需要在JAVA方法里实现这个功能。
以前没接触过这个,在网上搜了好几中方法,都没成功,不知道是什么原因。
我参考过的帖:http://blog.csdn.net/totogogo/archive/2007/10/18/1831588.aspx