在我的页面上有一个按钮,可以在弹出窗口中打开项目列表。当我在列表中选择一个项目时,我想将该项目的 id 传递给我的第一页的 backingbean。是否可以?它尝试这样做a4j:jsFunction
and a4j:param
但它不起作用。
这是我的代码:
page 1:
<a4j:jsFunction name="renderGuarantor" render="guarantor" actionListener="#{prospectDetail.setNewGuarantor}">
<a4j:param name="param1" assignTo="#{prospectDetail.newGuarantorId}" />
</a4j:jsFunction>
弹出页面:
<h:outputLink value="" onclick="window.opener.renderGuarantor(#{applicant.deposit_id});window.close();">
<h:graphicImage style="padding:0 1px; border:0" value="${path.staticRootUrl}images/confirm.gif" alt="${msg.applicantslist_select}" title="${msg.applicantslist_select}"/>
</h:outputLink>
这是第一页的支持 bean 代码
private Integer newGuarantorId;
public void setNewGuarantor() {
guarantor = newGuarantorId;
}
public Integer getNewGuarantorId() {
return newGuarantorId;
}
public void setNewGuarantorId(Integer newGuarantorId) {
this.newGuarantorId = newGuarantorId;
}
在弹出窗口中选择时,会调用我的 backingbean 中的方法,但是newGuarantorId
为空并且setNewGuarantorId
从未被调用过。
我的问题有解决办法吗?
嗯..这很奇怪,看起来没有什么问题..不是你问题的答案,但尝试这个解决方法 - 不要将值分配给guarantorId,而是将参数保留为<a4j:param name="param1"/>
并在actionListener
方法从请求中检索此 param1 作为String param1 = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("param1");
。
然后将此参数转换为 int 并进一步使用它。那应该有效
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)