同时最后我贴出部分我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} onclick="$('#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" onclick="createFile('${docType}','${workgroupId}','${projectId}','${evtcaseInstId}');">重新生成</button> <c:if test="${docType != '200101'}"><button id="butt4" ${button_css} onclick="closePage();">关闭</button></c:if> </div> </td> </tr> </table> </div> </div> </div> </div> </form> </body> </html>
仅供参考!
(未完待续)