潤乾報表在web頁面中的分頁問題
阿新 • • 發佈:2019-02-09
環境:
JavaWeb專案
問題描述:
在jsp頁面中能正常顯示潤乾報表,但是點選"下一頁"的圖示按鈕的時候報錯,報錯頁面如下:
jsp頁面程式碼如下:
<div id="div1" align="center" style="width: 100%; height: 80.5%;"> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; boolean needExport = (Boolean)request.getAttribute("needExport"); String processName = request.getParameter("processName"); request.setCharacterEncoding("gb2312"); String report="report_projectPub_table01.raq"; ReportDefine rd=null; if(report.endsWith(".xls")){ ExcelImporter ei = new ExcelImporter(application.getRealPath("/reportFiles/"+report)); rd=new ReportDefine(ei.getCellSet( 0 ) ); } else{ if(!report.endsWith(".raq")) report+=".raq"; rd=new ReportDefine(application.getResourceAsStream("/reportFiles/"+report)); } String param = (String)request.getAttribute("param"); request.setAttribute("rdName",rd); %> <report:html name="report1" beanName="rdName" srcType="defineBean" needPageMark="yes" saveAsName = "本級釋出_專案維度" displayNoLinkPageMark="no" params="" printedRaq = "report_projectPub_table01.raq" excelPageStyle ="0" appletJarName="runqian/runqianReportApplet.jar" funcBarLocation="bottom" pageMarkLabel="第{currPage}頁/共{totalPage}頁" width="1500" /> </div>
問題分析:
後來這樣分析:
在web頁面中,將滑鼠放在“下一頁”的圖示上,IE的左下角會出現連結地址
這時發現和會訪問後臺的連結是一樣的
通過IE的debug看,找到指令碼,選擇對應的頁面
會看到這樣的程式碼:
其實點選“下一頁”按鈕圖示的時候,預設是對form的遞交,而form的action預設是自身頁面
如果你的params引數是在jsp頁面中拼接的,則不用修改action地址,如果是後臺傳過來的,那麼你需要修改action
解決方法:
用js修改form的action為訪問後臺的地址,例如我這裡是在jsp頁面中最後新增以下程式碼:
<script type="text/javascript"> document.report1_turnPageForm.action= "<%=request.getContextPath()%>/runqianReportGrid/reportProjectPubTable.so"; </script>