12 Replies Latest reply on Feb 6, 2009 7:40 AM by Ilya Shaikovsky

    dataList + commandButton = weird problem

    eklam Newbie

      Hello all,

      I'm facing a strange problem when using a commandButton inside a dataList, the method "selecionaNoticia" in the action is simply not called! I've put a System.out.println("..."); in the method and nothing is printed...

      I've already used similar codes before and everything worked fine...

      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:ui="http://java.sun.com/jsf/facelets">
       <ui:composition template="/site/extras/template.xhtml">
       <ui:define name="buscar"></ui:define>
       <ui:define name="depoimentos"></ui:define>
       <ui:define name="publicidade"></ui:define>
       <ui:define name="content">
       <h2 class="tit_noticias">Banco de boas práticas</h2>
       <a4j:form id="frmFiltro" styleClass="form_segmento mright25">
       <span class="tit_filtrar">Filtrar NotÃcias</span>
       <h:selectOneMenu id="somAno" value="#{noticiaPublicaMB.anoFiltro}" class="default-usage-select" required="false">
       <f:selectItems value="#{noticiaPublicaMB.listAno}" />
       </h:selectOneMenu>
       <h:outputText value=" " />
       <h:selectOneMenu id="somMes" value="#{noticiaPublicaMB.mesFiltro}" class="default-usage-select" required="false">
       <f:selectItems value="#{noticiaPublicaMB.listMes}" />
       </h:selectOneMenu>
       <h:outputText value=" " /><a4j:commandButton action="#{noticiaPublicaMB.filtrarListNoticia}" value="--------" type="image" styleClass="bt_ok bt_not" reRender="frmNoticia" />
       </a4j:form>
       <a4j:form id="frmNoticia">
       <a4j:outputPanel id="pneList" rendered="#{noticiaPublicaMB.noticiaSelecionado == null}">
       <rich:dataList id="repNoticias" var="item" value="#{noticiaPublicaMB.listPag}" styleClass="listagem_noticias">
       <img alt="Trumb" src="#{item.arquivo.caminho}"/>
       <div class="content_not">
       <h3>#{item.titulo}</h3>
       <h4><h:outputText value="#{item.data}"><f:convertDateTime pattern="dd/MM/yyyy" /></h:outputText></h4>
       <p>#{item.descricaoComp}</p>
       <a4j:commandLink action="#{noticiaPublicaMB.selecionaNoticia}" reRender="pneList, pneForm" value="Acessar" title="Acessar" styleClass="bt_acessar">
       <a4j:actionparam name="idNoticia" value="#{item.id}" assignTo="#{noticiaPublicaMB.idNoticia}"/>
       </a4j:commandLink>
       </div>
       </rich:dataList>
       <div id="paginacao">
       <a4j:repeat id="repPagina" value="#{noticiaPublicaMB.paginas}" var="item" ajaxRendered="true">
       <a4j:commandLink reRender="repDepoimentos">
       #{item}
       <a4j:actionparam name="pagina" value="#{item}" assignTo="#{noticiaPublicaMB.pagAtual}"/>
       </a4j:commandLink>
       </a4j:repeat>
       </div>
       </a4j:outputPanel>
       <a4j:outputPanel id="pneForm" rendered="#{noticiaPublicaMB.noticiaSelecionado != null}">
       <div class="box_noticias">
       <div class="box_detalha">
       <img alt="foto" src="#{noticiaPublicaMB.noticiaSelecionado.arquivo.caminho}" style="margin-bottom: 0px;" />
       <ul class="praticas_dados_int">
       <li><span>#{noticiaPublicaMB.noticiaSelecionado.titulo}</span></li>
       <li>
       <h:outputText value="#{noticiaPublicaMB.noticiaSelecionado.data}">
       <f:convertDateTime pattern="dd/MM/yyyy" />
       </h:outputText>
       </li>
       </ul>
       <p>#{noticiaPublicaMB.noticiaSelecionado.descricaoComp}</p>
       <p>#{noticiaPublicaMB.noticiaSelecionado.fonte}</p>
       </div>
       </div>
       </a4j:outputPanel>
       </a4j:form>
       </ui:define>
       </ui:composition>
      </html>


      Thanks,