同時最後我貼出部分我jsp頁面,方法大家參考:
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.xxx.core.security.springsecurity.SpringSecurityUtils" %>
<%@ page import="com.xxx.infoDisposal.infosystemdesc.XmlPathDef" %>
<%@ include file="/common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>${projectName}-報告列表</title>
<%@ include file="/common/meta.jsp" %>
<script language="JavaScript">
//重新生成
function createFile(docType,workgroupId,projectId,evtcaseInstId){
if(confirm("是否確認重新生成")) {
window.location.href ="info-doc!creatdoc.action?creatOrnot=1&projectId=" + projectId + "&workgroupId=" + workgroupId + "&docType=" + docType + "&evtcaseInstId=" + evtcaseInstId;
buttdisabled();
$("#butt").bind("click", function () {
$("#divloading").mask("<font face='Tahoma' color='#104E8B' size='4'>正在生成中 可能時間較長 請耐心等待...</font>");
});
//$.blockUI({message:'<h2>正在生成中,可能時間較長 請耐心等待...</h2>'});
}
}
function buttdisabled(){
var obj = document.getElementById("butt");
if(obj != null){
obj.disabled=true;
}
}
$(document).ready( function() {
if('${projDocList}' == "[]" && ('${msg}' == null || '${msg}' == "")){
if(confirm("暫未生成報告,是否生成一個?")) {
window.location.href ="info-system-desc!showWordRp.action?projectId=${projectId}&workgroupId=${workgroupId}&docType=${docType}&evtcaseInstId=${evtcaseInstId}";
//$("#mainForm").attr("action", "load-sysinfo!importExcelSysInfo.action").submit(); &struts.token=${struts.token}
buttdisabled();
$("#divloading").mask("<font face='Tahoma' color='#104E8B' size='4'>正在生成中 可能時間較長 請耐心等待...</font>");
}
}else{
$.formValidator.initConfig({formid:"mainForm",onerror:function(msg){alert(msg);return false},onsuccess:function(){return true}});
$("#myFile").formValidator({onfocus:"請選擇報告文件",oncorrect:"恭喜您,選擇正確"}).regexValidator({regexp:"(.*)\\.(doc|docx)$",onerror:"文件爲空或類型不正確!只能爲:{doc|docx} 類型!"});
}
});
</script>
<base target="_self"/>
</head>
<body class="container1">
<form id="mainForm" action="info-doc!saveDoc.action" method="post" enctype="multipart/form-data">
<input type="hidden" name="docType" value="${docType}"/>
<input type="hidden" name="workgroupId" value="${workgroupId}"/>
<input type="hidden" name="projectId" value="${projectId}"/>
<div id="frame_content1">
<div id="frame_tab_tool">
<div>
<div>
<a href="javascript:void(0);" id="tab1"><div>${fn:substring(projectName, 0, 17)}<c:if test="${fn:length(projectName) > 17}">...</c:if>報告列表</div></a>
</div>
</div>
<script>
document.getElementById('tab1').className = "tab_bg_selected";
</script>
</div>
<div class="editbox_95" id="size_l_95">
<div class="formbox_100">
<div id="divloading">
<%if(request.getAttribute("msg") != null && !request.getAttribute("msg").equals("")){ %>
<table border="0" cellspacing="0" cellpadding="0" class="edittitle">
<tr>
<td>
<div class="addgroupicon_normal">
<font color='red'>溫馨提示:</font>
</div>
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" class="editmiddle" >
<tr>
<td>
<font size="3">
<%if(request.getAttribute("msg").equals("1")){%>
<br />
<b><font color='green'>恭喜:報告創建成功!</font></b>
<%}else if(request.getAttribute("msg").equals("2")){%>
<b><font color='green'>Sorry:報告創建失敗!</font></b><br />
1.請檢查模版文件是否存在或者已損壞!<font color='green'>(修復方案:在報告服務器上重新上傳該模版文件)</font><br />
2.請檢查數據庫報告服務器地址是否配置正確!<br />
3.請檢查報告服務器與應用服務器網絡是否通暢!
<%}else if(request.getAttribute("msg").equals("3")){%>
<br />
<b><font color='green'>恭喜:報告上傳成功!</font></b>
<%}else if(request.getAttribute("msg").equals("4")){%>
<br />
<b><font color='green'>Sorry:報告上傳失敗!</font></b>
<%}else if(request.getAttribute("msg").equals("5")){%>
<br />
<b><font color='green'>恭喜:報告刪除成功!</font></b>
<%}else if(request.getAttribute("msg").equals("6")){%>
<br />
<b><font color='green'>Sorry:報告刪除失敗!</font></b>
<%}else if(request.getAttribute("msg").equals("7")){%>
<br />
<b><font color='green'>Sorry:報告創建失敗!</font></b><br />
1.請檢查數據庫報告服務器地址是否配置正確!<br />
2.請檢查報告服務器與應用服務器網絡是否通暢!
<%}else if(request.getAttribute("msg").equals("8")){%>
<br />
<b><font color='green'>Sorry:報告創建失敗或者數據沒有保存成功!</font></b><br />
請嘗試重新生成!<br />
<%}else if(request.getAttribute("msg").equals("9")){%>
<br />
<b><font color='green'>Sorry:時間超時,報告創建失敗,請重試!</font></b>
<%}else{%>
<br />
${msg}
<% }%>
</font>
</td>
</tr>
</table>
<br />
<%} %>
<table border="0" cellspacing="0" cellpadding="0" class="edittitle">
<tr>
<td>
<div class="addgroupicon_normal">報告文檔列表<font color="red">【請仔細審覈平臺生成的文檔。濾除不必要的預置內容】</font>
</div>
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" class="vhdr2" id="tabledata">
<tr>
<th>標識</th>
<th>名稱</th>
<th>版本</th>
<th>生成時間</th>
<th>操作</th>
</tr>
<c:forEach items="${projDocList}" var="pro">
<tr>
<td width="70">${pro.docId} </td>
<td>${pro.dispName} </td>
<td width="50">v${pro.version} </td>
<td width="120"><fmt:formatDate value="${pro.createTime}" pattern="yyyy-MM-dd HH:mm:ss" type="both" dateStyle="full" timeStyle="full"/> </td>
<td class="caozuo2">
<a href="javascript:downfile('${pro.docId}');" >下載</a> |
<a href="javascript:deletefile('${pro.docId}','${projectId}','${workgroupId}','${docType}','${evtcaseInstId}');" >刪除</a>
</td>
</tr>
</c:forEach>
<c:if test="${empty projDocList}">
<tr>
<td colspan="5" id="member_middle">
暫無內容。
</td>
</tr>
</c:if>
</table>
<table border="0" cellspacing="0" cellpadding="0" class="edittitle">
<tr>
<td>
<div class="addgroupicon_normal">
重新上傳修改後的報告文檔
</div>
</td>
</tr>
</table>
<br />
<table border="0" cellspacing="0" cellpadding="0" class="editmiddle">
<tr>
<th>報告文檔:</th>
<td><input type="file" name="myFile" class="input_file" id="myFile"/>
<button ${buttonsm_css} οnclick="$('#mainForm').submit();">上傳 </button> (注:文件小於等於10M)<br /><span id="myFileTip"></span></td>
</tr>
</table>
<br />
<table border="0" cellspacing="0" cellpadding="0" class="editfoot">
<tr>
<td>
<div class="threebutton_box">
<button ${button_css} id="butt" οnclick="createFile('${docType}','${workgroupId}','${projectId}','${evtcaseInstId}');">重新生成</button>
<c:if test="${docType != '200101'}"><button id="butt4" ${button_css} οnclick="closePage();">關閉</button></c:if>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</form>
</body>
</html>
僅供參考!
(未完待續)