如何使用 JSF 动态地使用命令按钮打开新选项卡 link?
How to open new tab link with command button with JSF dynamically?
所以,我有一个用于打开新标签页的命令按钮 link 基于支持 bean。
此代码完美运行context.execute("window.open('http://localhost:8080/AdrenaWeb/faces/test.xhtml);");
但是,当我想将它 'hardcode link' 更改为动态变量 pathInfo 时,它无法工作。
String pathInfo = test.xhtml;
context.execute("window.open('http://localhost:8080/AdrenaWeb/faces/'+pathInfo );");
您没有在 java 代码中正确连接字符串,您需要这样做:
context.execute("window.open('http://localhost:8080/AdrenaWeb/faces/" + pathInfo + "');");
所以,我有一个用于打开新标签页的命令按钮 link 基于支持 bean。
此代码完美运行context.execute("window.open('http://localhost:8080/AdrenaWeb/faces/test.xhtml);");
但是,当我想将它 'hardcode link' 更改为动态变量 pathInfo 时,它无法工作。
String pathInfo = test.xhtml;
context.execute("window.open('http://localhost:8080/AdrenaWeb/faces/'+pathInfo );");
您没有在 java 代码中正确连接字符串,您需要这样做:
context.execute("window.open('http://localhost:8080/AdrenaWeb/faces/" + pathInfo + "');");