坑爹的ShowModalDialog 后台传值解决方案
今天遇到需要ShowModalDialog打开页面,通过acceptanceIds 参数值后台过滤出相应结果
前台
var url = "loadAcceptance.action?acceptanceIds=" + id("acceptanceIds").value ;
var returnValue = ShowModalDialog(url,1000,600);
后台:
public String loadAcceptance() {
if (StringUtils.isNotBlank(acceptanceIds)) {
ascceptances = expenseService.loadAscceptances(acceptanceIds, this.getBmYear());
}
return "ascceptances_detail";
}
结果:
后台显示acceptanceIds 值为null
思考后得知ShowModalDialog 无法直接将url中的参数值传递到后台如需传递到后台需先找jsp页面进行中转处理
解决方案:
前台页面:
var url = "popub_acceptance.jsp?acceptanceIds=" + id("acceptanceIds").value ;
var returnValue = uf_ShowModalDialog(url,1000,600);
中转jsp页面popub_acceptance.jsp
</head>
<%
String ls_QueryString = request.getQueryString();
%>
<body bgcolor="#FFFFFF" text="#000000" leftmargin=0 topmargin=0 >
<table width="100%" border="0" height="100%">
<tr>
<td>
<iframe id=iframe_list src="loadAcceptance.action?<%=ls_QueryString%>" frameborder=0 width=100% height="100%" scrolling="auto" align=center valign=top></iframe>
</td>
</tr>
</table>
</body>
</html>
后台
public String loadAcceptance() {
if (StringUtils.isNotBlank(acceptanceIds)) {
ascceptances = expenseService.loadAscceptances(acceptanceIds, this.getBmYear());
}
return "ascceptances_detail";
}
本文原创,转载必追究版权。