日期:2014-05-16 浏览次数:20298 次
<form action="testUpload.jsp" method="post" enctype="multipart/form-data" name="form"> 账套:<input type="text" name="acid" value="${param.acid}"/><br> 文件:<input type="file" name="fileName"><br> <button type="submit" name="提交" value="提交" onclick="validate()">提交</button> </form>
function validate(){ var accountId = document.form.acid.value; if(accountId == ""){ alert("账套不能为空"); return; } var url = ""; var file1 = document.form.fileName.value; var oldAction = document.form.action; if(file1 == null || file1 == "") { alert('请选择需要上传的文件'); return; }else { url = oldAction+"?fileName="+file1+"&acid="+accountId; alert(url); document.form.action=url; } document.form.submit(); }
<% String accountId = request.getParameter("acid"); if(StringUtils.isBlank(accountId))accountId = "ac_50001"; if(StringUtils.isNotBlank(accountId)){ JSONObject account= IsoneERPEngine.accountService.getAccount(accountId); if(account == null){ out.print("<font color=red>找不到对应的账套</font>"); return; } String message = SkuLedgerImport.importDoc(request,application); out.print(message); } %>