说明:
前端点击事件触发弹出dialog;
dialog内内容套用iframe加载单独的jsp页面;
单独jsp逻辑走动控制dialog所在页面的逻辑。
定义dialog所在页面:father
定义dialog载入页面:son
定义controller:controller
father.jsp
<div id="dialogDiv">
<iframe id="dialogIframe" height="100%" width="100%" frameborder="0" scrolling="no" />
</div>
father.js
$(function(){
$("#dialogDiv").dialog({
title:"标题",//标题
width: 980,//宽度
height: 450,//高度
top: 30,
closed: true,//初始关闭
cache: false,//缓存
modal: true,
onClose: function() {
$("#dialogIframe").attr("src","");
}
});
}
//触发运行
$("#dialogIframeWorkOrder").attr("src",_affairsContext+"/affMeetingNotice/addMeetingNotice?docId="+docId);
$('#dialogDivWorkOrder').dialog('open');
function closeDialogDiv(){
//类如设置个关闭dialog
$("#dialogDiv").dialog('close');
}
controller.java
@RequestMapping("/affMeetingNotice/addMeetingNotice")
@ResponseBody
public ModelAndView addMeetingNotice(HttpServletRequest request){
ModelAndView view = new ModelAndView();
try {
view.setViewName("/meeting/affMeetingNotice/儿子");
} catch (Exception e) {
ErrorPage.setpage(view, e);
}
return view;
}
son.js
//触发了父亲.js里的 closeDialogDiv方法
window.parent.closeDialogDiv();