如何使用JSF动态地使用命令按钮打开新的选项卡链接?

时间:2018-09-21 04:30:31

标签: javascript jsf primefaces

因此,我有一个命令按钮,该按钮用于打开基于后备bean的newtab链接。

此代码可以完美运行context.execute("window.open('http://localhost:8080/AdrenaWeb/faces/test.xhtml);");

但是,当我要将其“硬编码链接”更改为动态var pathInfo时,它将无法工作。

String pathInfo = test.xhtml;
context.execute("window.open('http://localhost:8080/AdrenaWeb/faces/'+pathInfo );");

1 个答案:

答案 0 :(得分:3)

您没有在Java代码中正确连接字符串,您需要这样做:

context.execute("window.open('http://localhost:8080/AdrenaWeb/faces/" + pathInfo + "');");
相关问题