坑爹的ShowModalDialog 后台传值解决方案

访客11年前 (2015-12-16)java技术6009

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


本文原创,转载必追究版权。

分享给朋友:

相关文章

Oracle 数据库cmd命令备份

 //导出exp wsbspt/wsbspt@192.168.1.101/wsbs file=D:/wsbspt.dmp log=D:/wsbspt.txt//导入imp &nbs...

使用Myeclipse 8.5开发基于JAX-WS的Web service实例

 本文为Web service 开发入门篇,主要介绍在Myeclipse 8.5环境下开发Web service的服务程序和客户端程序的基本流程。 在Weblogic 11g...

freemarker 判断日期变量为空处理 及InvalidReferenceException异常处理

at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98);InvalidR...

freeMarker Jfinal 获取session里的值

问题:freeMaker session取值的常用格式都试过 session["xxx"],session.xxx 直接xxx 都取不出来?????解决:JFinal与Struts...

MyEclipse 报错:'Building workspace' has encountered a problem解决方法

MyEclipse 报错:'Building workspace' has encountered a problem解决方法

          每次MyEclipse运行 工作空间报错如下:'Building workspac...

MyEclipse10.7注册码生成

注意经验里的工具可能不可用,请点击 生成注册码工具  下载。提取码:p1w4MyEclipse10.7注册码激活步骤:点击下面的链接http://jingyan.baidu.com/arti...

评论列表

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。