你好,我在一个jsp面中定义了两个form:form1和form2,
<form name="form1" action="servlet1" method="post">
<input type="hidden" name="pName1">
</form>
<form name="form2" action="servlet2" method="post">
<input type="text" name="pName2">
<input type="submit" name="submit" value="submit"></form>
<script>
founction add()
{
var temp = document.getElementByName("pName2").value; document.form1.pName1.value = temp
document.form1.submit();
}
</script>随后有一个连接 <a onclick="add();">添加</a>我向form2->pName2输入信息,然后点击"添加",在js中读取该信息,并赋给form1->pName1,然后提交到servlet1中,但是servlet1中取值为空.
<form name="form1" action="servlet1" method="post">
<input type="hidden" name="pName1">
</form>
<form name="form2" action="servlet2" method="post">
<input type="text" name="pName2">
<input type="submit" name="submit" value="submit"></form>
<script>
founction add()
{
var temp = document.getElementByName("pName2").value; document.form1.pName1.value = temp
document.form1.submit();
}
</script>随后有一个连接 <a onclick="add();">添加</a>我向form2->pName2输入信息,然后点击"添加",在js中读取该信息,并赋给form1->pName1,然后提交到servlet1中,但是servlet1中取值为空.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货