今天遇到了一个问题,用一个例子描述一下
<script type="text/javascript">
function setMail()  {
var flag = document.forms(0).check.checked;
if(flag) {
document.forms(0).mail.disabled = false;
document.forms(0).re_mail.disabled = false;
} else {
document.forms(0).mail.disabled = true;
document.forms(0).re_mail.disabled = true;
document.forms(0).mail.value = "";
document.forms(0).re_mail.value = "";
}

}
</script><html:form action="/test?action=test" >
<html:multibox property="check" value="0" onclick="setMail();">PC</html:multibox>
<br>Mail <html:text property="mail"/>
<br>Confirm <html:text property="re_mail"/>
<br>No <html:text property="no"/><input type="image">
</html:form>
如果先将mail和re_mail赋值为a,提交,struts默认将form的mail,remail no设置为"a" "a" ""
因为我对no字段有校验所以,退回到test页面此时test页面的text域值分别为"a" "a" ""
此时我将no添为a,并点击check,用javascript将mail,和re_mail的值赋为"".当我再次提交的时候,struts并不执行setMail(),setRe_mail()方法,所以这个时候session中form的值为 "a" "a" "a"而不是我期望的"" "" "a"。请问为什么?另外如何实现我要的效果,比较郁闷啊