执行打印后关闭弹出窗口 window
Closing a popup window after performing print
我有一个要求 tp 弹出 window 显示一个 pdf 页面,执行静默打印并关闭它。
String s =
"var win = window.open('PrintPopUp.jsf','_blank',\"height=300,width=200,scrollbars=no," +
"status=no, resizable=no, screenx=0, screeny=0\");" +
"win.onclick= function(){ win.close();}"
我使用上面的代码获取弹出窗口,单击打印时我将此代码写入我的页面,然后调用 servlet 生成 pdf;
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse();
RequestDispatcher dispatcher = request.getRequestDispatcher("/hisprintservlet");
我的问题是,我已经能够调出 window,执行静默打印,但无论我做什么,弹出窗口都不会关闭。
我使用的是 IE 11,项目使用的是 ADF 12c。
请帮忙..
查看有关弹出窗口的文档 here。
功能显示弹出(事件)
{
event.cancel();
变种来源=event.getSource();
var popupid="popup";
var popup = AdfPage.PAGE.findComponentByAbsoluteId(popupId);
if (!popup.isPopupVisible())
{
var hints = {};
hints[AdfRichPopup.HINT_LAUNCH_ID] = source.getClientId();
hints[AdfRichPopup.HINT_ALIGN_ID] = source.getClientId();
hints[AdfRichPopup.HINT_ALIGN] = AdfRichPopup.ALIGN_AFTER_START;
popup.show(hints);
}
}
函数 hidePopup(事件)
{
event.cancel();
变种来源=event.getSource();
var popupId = source.getProperty("popupId");
var isCanceled = source.getProperty("isCanceled");
var popup = AdfPage.PAGE.findComponentByAbsoluteId(popupId);
if (popup.isPopupVisible())
{
if (isCanceled)
popup.cancel();
else
popup.hide();
}
}
...
...
你好世界!
...
...
我找到了解决方案.. 我在弹出窗口中添加了一个 iframe window。在正文标签中,我添加了以下代码以关闭 ..
function test(win){if(win==null){alert('null');} else {setTimeout(function(win){this.close();},3000);}}
这在 IE11 中运行良好
我有一个要求 tp 弹出 window 显示一个 pdf 页面,执行静默打印并关闭它。
String s =
"var win = window.open('PrintPopUp.jsf','_blank',\"height=300,width=200,scrollbars=no," +
"status=no, resizable=no, screenx=0, screeny=0\");" +
"win.onclick= function(){ win.close();}"
我使用上面的代码获取弹出窗口,单击打印时我将此代码写入我的页面,然后调用 servlet 生成 pdf;
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse();
RequestDispatcher dispatcher = request.getRequestDispatcher("/hisprintservlet");
我的问题是,我已经能够调出 window,执行静默打印,但无论我做什么,弹出窗口都不会关闭。
我使用的是 IE 11,项目使用的是 ADF 12c。
请帮忙..
查看有关弹出窗口的文档 here。
功能显示弹出(事件) { event.cancel(); 变种来源=event.getSource(); var popupid="popup"; var popup = AdfPage.PAGE.findComponentByAbsoluteId(popupId);
if (!popup.isPopupVisible())
{
var hints = {};
hints[AdfRichPopup.HINT_LAUNCH_ID] = source.getClientId();
hints[AdfRichPopup.HINT_ALIGN_ID] = source.getClientId();
hints[AdfRichPopup.HINT_ALIGN] = AdfRichPopup.ALIGN_AFTER_START;
popup.show(hints);
}
}
函数 hidePopup(事件) { event.cancel(); 变种来源=event.getSource(); var popupId = source.getProperty("popupId"); var isCanceled = source.getProperty("isCanceled");
var popup = AdfPage.PAGE.findComponentByAbsoluteId(popupId);
if (popup.isPopupVisible())
{
if (isCanceled)
popup.cancel();
else
popup.hide();
}
} ... ... 你好世界!
... ...
我找到了解决方案.. 我在弹出窗口中添加了一个 iframe window。在正文标签中,我添加了以下代码以关闭 ..
function test(win){if(win==null){alert('null');} else {setTimeout(function(win){this.close();},3000);}}
这在 IE11 中运行良好