在我的页面上,我有一个按钮,用于打开弹出窗口中的项目列表。当我在列表中选择1个项目时,我想将项目的ID传递给我的第一页的backingbean。可能吗?它试图用a4j:jsFunction
和a4j:param
这样做,但它不起作用。如何将参数值传递给a4j:jsFunction
这是我的代码:
第1页:
<a4j:jsFunction name="renderGuarantor" render="guarantor" actionListener="#{prospectDetail.setNewGuarantor}">
<a4j:param name="param1" assignTo="#{prospectDetail.newGuarantorId}" />
</a4j:jsFunction>
popuppage:
<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
。
有没有解决我的问题?
你确定'#{applicant.deposit_id}'在新窗口中不为空吗? – Nikhil 2012-01-02 17:44:50
是的,它填写了正确的ID。 – roel 2012-01-03 08:41:21
嗯..多数民众赞成在奇怪的,没有看起来错了..不是你的问题的答案,但尝试这种解决方法 - 而不是将值分配给'guarantorId',保持参数为''并在'actionListener'方法中从请求中获取这个'param1'作为'String param1 = FacesContext.getCurrentInstance()。getExternalContext()。getRequestParameterMap()。get(“param1”);'。然后将此参数转换为“int”并进一步利用它。这应该工作。 –
Nikhil
2012-01-03 11:38:42