Q:

setPropertyActionListener not working properly

Possible Duplicate:
primefaces selectOneMenu doesn’t working when it should 

my setPropertyActionListener is not setting the corresponding bean property. I need to get the select public after i click the corresponding delete button (cbViewExcluir) which shows a confirm dialog before delete. Below is my xhtml:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:p="http://primefaces.org/ui"
            template="./../../resources/templates/baseTemplate.xhtml">

<ui:define name="content">
    <f:view id="vRoot">
        <p:fieldset legend="Manage publics">
            <h:form id="frmPublics">

                <!-- Global messages -->
                <p:growl id="gMessages" sticky="false" globalOnly="true" />

                <!-- Public list on dataTable -->
                <p:dataTable id="dtPublics" 
                             value="#{publicBean.lstPublics}"
                             paginator="true" rows="5" 
                             rowsPerPageTemplate="5,10"
                             paginatorPosition="bottom"
                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             var="actual">

                    <f:facet name="header">
                        <p:commandButton id="cbViewNew" value="New" type="button"  onclick="dlgNew.show();" />
                    </f:facet>
                    <!-- Colunas de edição e exclusão -->
                    <p:column>
                        <f:facet name="header">
                            <h:outputLabel value="Edit"/>
                        </f:facet>
                        <p:commandButton id="cbViewEdit"  
                                         image="ui-icon-pencil" 
                                         title="Edit"
                                         update=":frmEdit:pEditPublic"
                                         oncomplete="dlgEdit.show();">
                            <f:setPropertyActionListener value="#{actual}" target="#{publicBean.selectedPublic}" />
                        </p:commandButton>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputLabel value="Delete"/>
                        </f:facet>
                        <p:commandButton id="cbViewDelete" onclick="dlgDelete.show();" 
                                         icon="ui-icon-close" title="Delete">
                            <f:setPropertyActionListener value="#{actual}" target="#{publicBean.selectedPublic}" />
                        </p:commandButton> 
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            Name
                        </f:facet>
                        <h:outputLabel id="olViewPublicName" value="#{actual.publicName}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            Public Type
                        </f:facet>
                        <h:outputLabel id="olViewPublicType" value="#{actual.publicType}"/>
                    </p:column>
                </p:dataTable>
            </h:form>

            <!-- New dialog -->
            <p:dialog id="dlgNewPublic" widgetVar="dlgNew" modal="true" header="New Public"
                      resizable="false">
                <h:form id="frmNew">
                    <p:panel id="pNewPublico">
                        <p:messages id="mNewMessages" redisplay="false" />
                        <p:panelGrid columns="2">
                            <p:outputLabel id="olNewPublicName" value="Name:" for="itNewPublicName"/>
                            <p:inputText id="itNewPublicName" value="#{publicBean.name}" required="true"
                                         requiredMessage="Enter the public name."/>

                            <p:outputLabel id="olNewPublicType" for="somNewPublicType" value="Public type:"/>
                            <p:selectOneMenu id="somNewPublicType" value="#{publicBean.publicType}" effect="fade" 
                                             converter="#{publicBean.converter}" 
                                             required="true" requiredMessage="Enter the public type."
                                             > 
                                <f:selectItem itemLabel="-- Select --" itemValue=""/>
                                <f:selectItems value="#{publicBean.publicTypes}" var="actual" itemLabel="#{actual.label}" itemValue="#{actual}"></f:selectItems>
                            </p:selectOneMenu>
                            <p:commandButton value="Cancel" immediate="true" onclick="dlgNew.hide()"/>
                            <p:commandButton id="cbSaveNew" value="Save" 
                                             actionListener="#{publicBean.save}"
                                             oncomplete="handleSave(xhr, status, args);" 
                                             update=":frmPublics:dtPublics :frmNew :frmPublics:gMessages"
                                             ajax="true"/>
                        </p:panelGrid>
                    </p:panel>
                </h:form>
            </p:dialog>

            <!-- Delete dialog -->
            <p:confirmDialog id="dialogDelete" message="Are you sure?"
                             header="Delete public" severity="alert" 
                             widgetVar="dlgDelete">
                <h:form id="frmDelete">
                    <p:commandButton id="cbDeleteCancel" value="Cancel" onclick="dlgDelete.hide()" type="button" /> 
                    <p:commandButton id="cbDeleteContinue" value="Continue"
                                     update=":frmPublics:dtPublics :frmPublics:gMessages" 
                                     oncomplete="dlgDelete.hide()"
                                     actionListener="#{publicBean.delete}"/>
                </h:form>
            </p:confirmDialog>

            <!-- Edit dialog -->
            <p:dialog id="dialogEdit" widgetVar="dlgEdit" header="Edit public"
                      resizable="false" modal="true">
                <h:form id="frmEdit">
                    <p:panel id="pEditPublic">
                        <p:messages id="mEditMessages" redisplay="false" />
                        <p:panelGrid columns="2">
                            <p:outputLabel id="olEditPublicName" value="Name:" for="itEditPublicName"/>
                            <p:inputText id="itEditPublicName" value="#{publicBean.selectedPublic.publicName}" required="true"
                                         requiredMessage="Enter the public name."/>

                            <p:outputLabel id="olEditPublicType" for="somEditPublicType" value="Public type:"/>
                            <p:selectOneMenu id="somEditPublicType" 
                                             value="#{publicBean.selectedPublic.publicType}" 
                                             effect="fade" 
                                             converter="#{publicBean.converter}" 
                                             required="true" 
                                             requiredMessage="Select a public type."
                                             > 
                                <f:selectItem itemLabel="-- Select --" itemValue=""/>
                                <f:selectItems value="#{publicBean.publicTypes}" 
                                               var="actual" 
                                               itemLabel="#{actual.label}" 
                                               itemValue="#{actual}"></f:selectItems>
                            </p:selectOneMenu>
                            <p:commandButton value="Cancel" immediate="true" onclick="dlgEdit.hide()"/>
                            <p:commandButton id="cbEditSave" value="Save" 
                                             actionListener="#{publicBean.alter}"
                                             oncomplete="dlgEdit.hide();" 
                                             update=":frmPublics :frmEdit"/>
                        </p:panelGrid>
                    </p:panel>
                </h:form>
            </p:dialog>
        </p:fieldset>
    </f:view>

    <!-- Javascript callbacks -->
    <script type="text/javascript">
        function handleSaved(xhr, status, args){
            if(args.saved){
                dlgNew.hide();
            }
        }
        function handleEdited(xhr, status, args){
            if(args.edited){
                dlgEdit.hide();
            }
        }
    </script>
</ui:define>

And my bean is as follows:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
*/
package br.siseventos.managed;

import br.siseventos.dao.da.PublicoDAO;
import br.siseventos.dao.da.TipoPublicoDAO;
import br.siseventos.model.TbPublico;
import br.siseventos.model.TdTipoPublico;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;
import org.primefaces.context.RequestContext;

@ManagedBean(name = "publicoBean")
@SessionScoped
public class PublicoBean {

    // Campos
    private TipoPublicoDAO daoTipoPublico = null;
    private PublicoDAO daoPublico = null;

    private String nome;
    private List<SelectItem> lstMenuTipoPublico = new ArrayList<SelectItem>();
    private TdTipoPublico tipoPublicoSelecionado = null;

    private List<TbPublico> lstDataTablePublico = null;
    private TbPublico publicoSelecionado;

    // Util
    private int maximoLinhasTablePublico = 5;
    private boolean mostrarMsg = false;

    // Construtor
    public PublicoBean() {
        // Inicializando as daos
        daoPublico = new PublicoDAO();
        daoTipoPublico = new TipoPublicoDAO();

        // Carregando o datatable de publicos
        lstDataTablePublico = daoPublico.consultarTodos();

        // Carregando o menu de tipos de público
        List<TdTipoPublico> l = getDaoTipoPublico().consultarTodos();
        Iterator<TdTipoPublico> i = l.iterator();
        while (i.hasNext()) {
            TdTipoPublico atual = (TdTipoPublico) i.next();
            lstMenuTipoPublico.add(new SelectItem(atual, atual.getNmeTipoPublico()));
        }
    }

    public TipoPublicoDAO getDaoTipoPublico() {
        return daoTipoPublico;
    }

    public void setDaoTipoPublico(TipoPublicoDAO daoTipoPublico) {
        this.daoTipoPublico = daoTipoPublico;
    }

    public PublicoDAO getDaoPublico() {
        return daoPublico;
    }

    public void setDaoPublico(PublicoDAO daoPublico) {
        this.daoPublico = daoPublico;
    }

    // Getters e Setters
    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public List<SelectItem> getLstMenuTipoPublico() {
        return lstMenuTipoPublico;
    }

    public void setLstMenuTipoPublico(List<SelectItem> lstMenuTipoPublico) {
        this.lstMenuTipoPublico = lstMenuTipoPublico;
    }

    public TdTipoPublico getTipoPublicoSelecionado() {
        return tipoPublicoSelecionado;
    }

    public void setTipoPublicoSelecionado(TdTipoPublico tipoPublicoSelecionado) {
        this.tipoPublicoSelecionado = tipoPublicoSelecionado;
    }

    public List<TbPublico> getLstDataTablePublico() {
        return lstDataTablePublico;
    }

    public void setLstDataTablePublico(List<TbPublico> lstDataTablePublico) {
        this.lstDataTablePublico = lstDataTablePublico;
    }

    public int getMaximoLinhasTablePublico() {
        return maximoLinhasTablePublico;
    }

    public void setMaximoLinhasTablePublico(int maximoLinhasTablePublico) {
        this.maximoLinhasTablePublico = maximoLinhasTablePublico;
    }

    public boolean isMostrarMsg() {
        return mostrarMsg;
    }

    public void setMostrarMsg(boolean mostrarMsg) {
        this.mostrarMsg = mostrarMsg;
    }

    public TbPublico getPublicoSelecionado() {
        return publicoSelecionado;
    }

    public void setPublicoSelecionado(TbPublico publicoSelecionado) {
        this.publicoSelecionado = publicoSelecionado;
    }

    // Actions e listeners
    public void cadastrarPublico(ActionEvent ex) {
        FacesContext contexto = FacesContext.getCurrentInstance();
        FacesMessage msg = new FacesMessage();
        try {
            TbPublico p = new TbPublico();
            p.setNmePublico(getNome());
            p.setTdTipoPublico(getTipoPublicoSelecionado());

            getDaoPublico().incluir(p);

            // Carregar a lista de publicos novamente
            lstDataTablePublico = getDaoPublico().consultarTodos();

            // Mostrando msg de sucesso!
            msg.setSummary("Público cadastrado com sucesso!");
            msg.setSeverity(FacesMessage.SEVERITY_INFO);
            contexto.addMessage(null, msg);

            // Invocando script no cliente
            RequestContext rc = RequestContext.getCurrentInstance();
            rc.addCallbackParam("salvo", true);

        } catch (Exception e) {
            msg.setSummary("Erro ao cadastrar público!");
            msg.setSeverity(FacesMessage.SEVERITY_ERROR);
            contexto.addMessage(null, msg);
        }
    }

    public void excluirPublico(ActionEvent e) {
        FacesMessage msg = new FacesMessage();
        FacesContext contexto = FacesContext.getCurrentInstance();
        // Mostrando msg de sucesso!
        msg.setSummary(publicoSelecionado.getNmePublico());
        msg.setSeverity(FacesMessage.SEVERITY_INFO);
        contexto.addMessage(null, msg);
        /*try {
            // Excluindo o publico selecionado
            daoPublico.excluir(getPublicoSelecionado().getIdtPublico());
        } catch (Exception ex) {
            msg.setSummary("Erro ao cadastrar público!");
            msg.setSeverity(FacesMessage.SEVERITY_ERROR);
            contexto.addMessage(null, msg);
        }*/
    }

    public void alterarPublico() {
        FacesMessage msg = new FacesMessage("Publico alterado!");
        FacesContext.getCurrentInstance().addMessage(null, msg);
    }
    // Converters

    public Converter getConversor() {
        return new Converter() {

            @Override
            public Object getAsObject(FacesContext context, UIComponent component, String value) {
                // Transformar string em objeto
                TdTipoPublico r = null;
                try {
                    r = getDaoTipoPublico().consultarPorIdt(Integer.parseInt(value));
                } catch (NumberFormatException e) {
                }

                return r;

            }

            @Override
            public String getAsString(FacesContext context, UIComponent component, Object value) {
                // Transformar objeto em string
                String r = null;
                if (value instanceof TdTipoPublico) {
                    r = ((TdTipoPublico) value).getIdtTipoPublico().toString();
                }
                return r;
            }
        };

    }
}

There is something i'm doing wrong?

A:

its because of the attribute type="button" which is not firing the actionlistener. 
when you declare this attribute  (type="button") its not a p:commandButton anymore.
type="button" is push button purposes, it does not do any action or submit the form
try to remove type="button" attribute.  it'd fire the actionlistener.
     <p:commandButton id="cbViewExcluir" 

                                     image="ui-icon-circle-close" 
                                     onclick="dlgExcluir.show()" 
                                     title="Excluir"
                                     update=":frmExcluir">

                        <!-- This is not working properly -->
                        <f:setPropertyActionListener value="#{atual}" target="#   {publicoBean.publicoSelecionado}" />
                    </p:commandButton> 

lemme know if this helps :)

