开发者

setPropertyActionListener on commandLink inside ui:repeat with a composite component

I've created a composite component that has a commandLink embedded inside of a ui:repeat. I need to be able to dynamically change the method that is called via the commandLink's action property but it doesn't seem to be possible due to the fact that you need to specify the ID of the commandLink in the

Since the commandLinks are in a UI:repeat, they all have a dynamic ID.

As a workaround, I'm trying to use setPropertyActionListener on the command link. However, it doesn't look like the method is ever being called. Am I missing something? Is this the wrong way to go about what I want?

Here is some sample code.

Composite Component:

<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}"/>

Using Page:

<q:userList id="userList" 
   value="#{caseWizardBackingBean.companyContacts}" 
   renderHead开发者_如何学Cer="false" 
   resultLinkActionListener="#{caseWizardBackingBean.selectedCompanyContact}"/>

Bean:

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

I tried adding some debug statements and breakpoints into the property's getter and setter but they are never hit. I'm guessing something odd is happening because all of the examples I can find show that this should work (but they don't use a composite component).

I should point out, I'm using the Primefaces commandLink but this seems to happen with the regular commandLink too.


OK, from what I can tell this can't be done in the current version of JSF (2.1.3).

In order to work around the issue I made the component a single commandLink and then the using page has a ui:repeat with the commandLink inside of it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜