日期:2014-05-18  浏览次数:20755 次

jsp 重定向 同时 post 数据
我的两个页面,一个是jsp,另外一个是php的,现在需要从jsp网页向php网页传递一个post方式的数据,请问怎么做?
注:--我用了response.sendRedirect"http://我的ip/页面.php?name=gavin",但是这个是get的方法,不想用,请问这样的情况怎么post数据,我是php的程序员。

------解决方案--------------------
用:
<form name="form1" action="http://我的ip/页面.php">
<input type="hidden" name="name" value="gavin"/>
</form>

<script>
form1.submit();
</script>
替换掉:response.sendRedirect"http://我的ip/页面.php?name=gavin"

:-)

------解决方案--------------------
1 类似楼上的方法,直接在页面提交到 .php 文件就可以了
2 在服务器端,用 HttpURLConnection 模拟 POST 提交也可以

简单应用,推荐第一个
------解决方案--------------------
探讨
用:
<form name="form1" action="http://我的ip/页面.php">
<input type="hidden" name="name" value="gavin"/>
</form>

<script>
form1.submit();
</script>
替换掉:response.sendRedirect"http://我的ip/页面.php?name=gavin"

:-)