从服务器端代码在新的browsertab中打开JSP [英] Open JSP in new browsertab from serverside code

查看:118
本文介绍了从服务器端代码在新的browsertab中打开JSP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过服务器端jsf代码在新的浏览器选项卡中打开资源(如用于命令按钮的target ="_ newtab")?

Is it possible to open a resource into a new browser Tab (like target="_newtab" for command buttons) from server side jsf code?

以下代码在同一选项卡中打开资源:

The following Code opens the resource in the same tab:

FacesContext.getCurrentInstance().getExternalContext().redirect("resource.jsp"); 

我正在使用素数.我认为javascript和icefaces很有可能.

I'm using primefaces. I think there is a possibility with javascript and icefaces.

推荐答案

我发现的最佳解决方案是:

The best solution that I found was:

RequestContext context = RequestContext.getCurrentInstance();
context.execute("window.open('resource.jsp', '_newtab')");

这篇关于从服务器端代码在新的browsertab中打开JSP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆