【急】java上传文件jsp页面跳转文件上传
齊麟 2010-09-17 09:32:20 页面①中有:
<input type="button" value="上传文件" onclick="uploadData();"/>点击后跳转到上传页面②,js:
/**
* 上传数据(页面跳转)
*/
function uploadData(){
var indexTypeName = "<%=request.getParameter("indexTypeName")%>";
window.location = "<%=path %>/maew/monitor/maintainMaew/upLoadData.jsp?indiType=1&indexTypeName="+indexTypeName;
}
页面②中:
<form action="" method="post" enctype="multipart/form-data" id="uploadForm" name="uploadForm" onsubmit="return checkUploadForm();">
<input type="file" name="indiDataFile" id="indiDataFile" />
<input type="submit" name="button2" id="button2" value="上传" />
</form>
但是奇怪的是:当鼠标放在上传文件的页面②的上传按钮上面时,浏览器状态栏显示的路径居然是页面①跳转到页面②时的路径"<%=path %>/maew/monitor/maintainMaew/upLoadData.jsp?indiType=1&indexTypeName="+indexTypeName;,
点击该按钮只能会刷新该页面②,无法实现上传等操作。
页面②form的action是该form onsubmit时调用的checkUploadForm方法里面赋值的
function checkUploadForm(){
var uploadForm = document.getElementById("uploadForm");
if(。。。){
。。。
return false;
}esle{
uploadForm.action = "..... .....";
return true;
}
http://topic.csdn.net/u/20100916/14/0e9a1958-33ac-4509-a154-129c3b1591ef.html