大佬教程收集整理的这篇文章主要介绍了动作表单不止一个Servlet,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
在客户端,您可以通过指定两个不同的目标窗口来保存响应,从而通过JavaScript将表单提交到两个不同的servlet。
HTML:
<iframe ID="firstResult" name="firstResult"></iframe>
<iframe ID="secondResult" name="secondResult"></iframe>
JavaScript:
function submitForm() {
var form = document.getElementByID("myForm");
form.action = "/first-servlet";
// Target is the name of the iframe to hold the response from first servlet.
form.target = "firstResult";
form.submit();
form.action = "/second-servlet";
// Target is the name of the iframe to hold the response from second servlet.
form.target = "secondResult";
form.submit();
}
然后,您应该具有处理程序来捕获iframe的onload事件,以处理来自Servlet的响应。
尽管听起来可能有些愚蠢,但我仍然在问这个概念性和逻辑性(据我所知:))问题:
在一个jsp页面中,我可以将其表单数据发送到多个Servlet吗?
form action="home","car" method="post" name="f1"
要么
form name='form' method='POST' action='car','home'
任何输入..... //
以上是大佬教程为你收集整理的动作表单不止一个Servlet全部内容,希望文章能够帮你解决动作表单不止一个Servlet所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。