Search code examples
jsfprimefacesmanaged-bean

f:setPropertyActionListener does not set property


I am lost. I researched almost every post about setPropertyListener and I do not know what I'm doing wrong. I have this JSF Page:

<ui:define name="content">
    <h:form id="itemSearchForm">
        <p:commandButton update=":itemForm" 
                         icon="ui-icon ui-icon-search">
            <f:setPropertyActionListener target="#{itemDetailManagedBean.itemId}" 
                                         value="test"/>
            <f:setPropertyActionListener target="#{itemDetailManagedBean.accountType}" 
                                         value="test"/>
        </p:commandButton>
        <p:dataTable id="itemList" 
                     paginator="true" 
                     var="currentItem" 
                     value="#searchItemManagedBean.searchItems}">
            .
            . 
            <p:column headerText="Detail">
                <p:commandButton update=":itemForm" 
                                 oncomplete="PF('itemDetail').show()" 
                                 icon="ui-icon ui-icon-search">
                    <f:setPropertyActionListener target="#{itemDetailManagedBean.itemId}" 
                                                 value="test"/>
                    <f:setPropertyActionListener target="#{itemDetailManagedBean.accountType}" 
                                                 value="test"/>
                </p:commandButton>
            </p:column>
        </p:dataTable>
    </h:form>
</ui:define>

and itemDetailManagedean:

public class ItemDetailManagedBean implements Serializable{

    private String itemId,accountType;

    public ItemDetailManagedBean() {
    }

    public SearchForItemBean getSearchBean() {
        return searchBean;
    }

    public String getItemId() {
        return itemId;
    }

    public String getAccountType() {
        return accountType;
    }

    public void setItemId(String itemId) {
        this.itemId = itemId;
    }

    public void setAccountType(String accountType) {
        this.accountType = accountType;
    }


}

The problem is, that the first commandButton is working as it should(so it set the properties right). But the second commandButton does not work at all. Both button shows dialog, as they should. I have itemForm on the other part of page.


Solution

  • Got the sollution finally. The problem was actually not in the JSF but in ServiceBean, which had changed the data table content during the loading.