环境:
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 name="report1_turnPageForm" method=post action="http://<ip>:<端口>/URL/report_projectPubTable.jsp?1450407304547" style="display:none">
其实点击“下一页”按钮图标的时候,默认是对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>