在客户端,您可以通过指定两个不同的目标窗口来保存响应,从而通过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的响应。



