是否可以执行转发到新窗口?
我们正在使用 ICEFaces 1.8,我想执行到新 URL 的转发,但希望它在新窗口中打开。我们目前能够执行到新窗口的重定向,如下所示:
public static void redirectToUrl(String urlPath) {
if (urlPath != null) {
try {
final String url = FacesUtil.getContextPath() + urlPath;
final StringBuffer jsCommand = new StringBuffer();
jsCommand.append("window.document.location.href='").append(url).append("';");
JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), jsCommand.toString());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
但是可以使用类似的方法进行转发吗?
We are using ICEFaces 1.8 and I would like to perform a forward to a new URL, but want it to open in a new window. We are currently able to perform a redirect to a new window as:
public static void redirectToUrl(String urlPath) {
if (urlPath != null) {
try {
final String url = FacesUtil.getContextPath() + urlPath;
final StringBuffer jsCommand = new StringBuffer();
jsCommand.append("window.document.location.href='").append(url).append("';");
JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), jsCommand.toString());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
But is a forward possible using a similar approach?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
window.open(url)
。Try
window.open(url)
.