今天遇到需要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";
}