【发布时间】:2014-04-22 11:28:39
【问题描述】:
我的问题类似于issue
我有一个在 XHTML 中,它调用支持 bean 方法来调用具有预先构造的 URL 的新窗口。但我的问题是它没有打开 URL。
我的 XHTML 代码如下
<h:commandButton style="margin-left:1em;width: auto; height: 20px;font-size:85%"
value="WebPhone" id="lwebpne"rendered="#{Bean.editCmdActionflg == true and (Bean.selectedSearchSysDetRow.isfeed != '1' or Bean.selectedOverviewDetails.webPheFlg == false)}"actionListener="#{Bean.webPhoneSearch}" >
<f:param name="lpid" value="lpid" />
</h:commandButton>
而我在支持 bean 中给出的代码
public void webPhoneSearch(ActionEvent event) {
logger.info("webPhoneSearch Method Enter ..");
String param = "";
Map<String, String> params = FacesContext.getCurrentInstance()
.getExternalContext().getRequestParameterMap();
if (params.get("lpid") != null) {
System.out.println("coming inside>>>>>");
// String t_lpid = params.get("lpid");
String t_lpid = selectedOverviewDetails.getLeadPrgMgrUid();
Matcher matcher = pattern.matcher(t_lpid);
if (matcher.matches()) {
param = "this values comes from UI ";
}
}
// below is a URL where the window will launch to show the details of a person which we are search for
Url = "http:// URL for searching a person in webphone" +param;
RequestContext.getCurrentInstance().execute(
"window.open('" + Url + "')");
logger.info("webPhoneSearch Method Exit ..");
}<br/>
我的问题是点击<h:commandbutton> 不会打开新窗口,而是在我点击<h:commandbutton> 时在当前窗口中重新打开同一页面
请让我知道您对解决此问题的建议。
【问题讨论】:
-
h:commandButton没有属性target在您的h:form上尝试,如另一个问题中的回答。
标签: java jsf jsf-2 primefaces