<INPUT type="button" ONCLICK="set('delete')" value="删除文件"> <INPUT type="button" ONCLICK="set('upload')" value="上传文件">js代码: function set(key){ var str1=document.getElementById("type1").value; var str2=document.getElementById("type2").value; var str3=encodeURI(document.getElementById('selectFile').value); var str4=encodeURI(document.getElementById('paraFiles').value); document.getElementById("form1").action="UploadServlet?flag=" + key+"&type1="+str1+"&type2="+str2+"&selectFile="+str3+"¶Files="+str4; document.getElementById("form1").submit(); }
document.forms[0].submit();
如上,每个button都提交到不同的action就可以解决
<INPUT type="button" ONCLICK="set('upload')" value="上传文件">js代码:
function set(key){
var str1=document.getElementById("type1").value;
var str2=document.getElementById("type2").value;
var str3=encodeURI(document.getElementById('selectFile').value);
var str4=encodeURI(document.getElementById('paraFiles').value);
document.getElementById("form1").action="UploadServlet?flag=" + key+"&type1="+str1+"&type2="+str2+"&selectFile="+str3+"¶Files="+str4;
document.getElementById("form1").submit();
}
还要补充一下,我是用配置validation.xml来验证表单的,
现在是点击第一个按钮总是提交全部表单,我就是不想这样,
2)我只是想第一个按钮通过XXX.action.do可以调用一个方法
search(),来查询数据再返回到本页面显示在text文本框中3)然后修改返回的数据,再点击第二个按钮提交调用insert()方法,插入数据库中去4)我想把search()与insert()方法放在一个继承了ValidatorAction的类中5)请问该怎么实现下??