gpt4 book ai didi

jsf-2 - ui :repeat with a composite component 内 commandLink 上的 setPropertyActionListener

转载 作者:行者123 更新时间:2023-12-02 05:09:22 24 4
gpt4 key购买 nike

我创建了一个复合组件,它在 ui:repeat 中嵌入了一个 commandLink。我需要能够动态更改通过 commandLink 的 action 属性调用的方法,但由于您需要在

由于 commandLinks 在 UI:repeat 中,它们都有一个动态 ID。

作为解决方法,我尝试在命令链接上使用 setPropertyActionListener。但是,看起来该方法从未被调用过。我错过了什么吗?这是实现我想要的目标的错误方法吗?

这是一些示例代码。

复合组件:

<ui:repeat value="#{cc.attributes.value}" var="aUser">
<li class="ui-widget-content ui-state-default q-userListResult">
<p:commandLink
styleClass="q-userList-resultLink"
update=":userList:q-userList-formUsers:userToolTip">
<f:setPropertyActionListener value="{aUser}" target="#{cc.attributes.resultLinkActionListener}"/>

使用页面:

<q:userList id="userList" 
value="#{caseWizardBackingBean.companyContacts}"
renderHeader="false"
resultLinkActionListener="#{caseWizardBackingBean.selectedCompanyContact}"/>

bean 类:

private CTProfile selectedCompanyContact;
public CTProfile getSelectedCompanyContact() { return this.selectedCompanyContact; }
public void setSelectedCompanyContact(CallTrackProfile ctp) { this.selectedCompanyContact = ctp; }

我尝试将一些调试语句和断点添加到属性的 getter 和 setter 中,但它们从未被命中。我猜发生了一些奇怪的事情,因为我能找到的所有示例都表明这应该有效(但它们不使用复合组件)。

我应该指出,我使用的是 Primefaces commandLink,但这似乎也发生在常规 commandLink 上。

最佳答案

好的,据我所知,这在当前版本的 JSF (2.1.3) 中无法完成。

为了解决这个问题,我将组件设为单个 commandLink,然后使用页面在其中包含一个 ui:repeat 和 commandLink。

关于jsf-2 - ui :repeat with a composite component 内 commandLink 上的 setPropertyActionListener,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7325614/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com