我有一个JSF/primefaces托管bean。我试图在同一个托管bean中将托管bean变量传递给JavaScript函数,但是我不成功。有人可以帮助我完成这项任务。将JSF(primefaces)托管bean变量传递给javascript函数
我的托管bean代码段
reportName=report[0];
url="http://cvgapp42q/Reports/Pages/Report.aspx?ItemPath=%2fLPSR%2f"+reportName;
try {
RequestContext.getCurrentInstance().execute("window.open('#{repBean.url}')");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
URL是我试图使用表达式#{repBean.url}在JavaScript功能window.open()
指可变在此先感谢
,谢谢你的回复.repBean.getUrl()获取当前页面的url。但是我打开一个新的url http://cvgapp42q/Reports/Pages/Report.aspx .....如上所述这个问题。我只是想知道如何将包含url值的变量** url **传递给js函数,以便该值可检测并打开新的网页。 – rks 2014-10-28 13:56:54
我不知道我是否真的明白你想要什么(这可能是因为我的英语不好)。如果你只想打开'url',你可以使用'RequestContext.getCurrentInstance()。execute(“window.open('”+ url +“')”); – drkunibar 2014-10-28 14:44:55