开发者

commandButton does not invoke bean action method

Im having a big issue with JSF2 render actions. Im using a simple c:forEach to iterate over a List. This list has itens and those items has a List of more Itens. So its a nested c:forEach. The sub list has an input field that, once saved, has to go to the bean, save this new input, and get back to the screen with the updated List. Nothing complex to do. When i debug the method that sends the List back to the view, i see that all the information is correct. So here we go with the issue : The first time the commandButton works fine. But if i try to click on another button on the list just after it was refreshed, the button does not call my method. Whats wierd is that the action does sends it to the bean (it goes thru my @PostConstruct method), but does not call the method i want.

The code :

 <c:forEach var="pub" items="${publicacaoCidadeController.listaPublicacao}" varStatus="status">
        <div>message from first list : ${status.count} <br/>
            <h:outputLabel value="#{pub.publicacao.mensagem}" />
            <br/><br/>message from second list :<br/>
            <h:form>
            <f:ajax event="action" execute="@form" render="@开发者_开发百科all">
            <c:forEach id="test2" var="com" items="#{pub.publicacao.comentarioList}" >                                 
                <div>
                <h:outputLabel value="#{com.mensagem}" />
                </div>                                
            </c:forEach> 
            <div>
            <h:inputTextarea value="#{publicacaoCidadeController.msgComentarioNovo}" />
            <div >                                    
                    <h:commandButton type="submit" value="Postar" action="#{publicacaoCidadeController.salvarComentario}" >
                        <f:param name="codPublicacao" value="#{pub.publicacao.codPublicacao}"/>
                        <f:param name="postNum" value="${status.count}"/>
                    </h:commandButton>
                </div>                                     
                </div>
                </f:ajax>
                </h:form>              
            </div>
    </c:forEach>

Any ideas guys?


Try to use ui:repeat tag. c:foreach is a build-view-tag and ui:repeat is a render-tag. After pressing the command button the jsf-tree isn't rebuild ...

If you include the ui:debug tag, you can consult the de jsf-tree and investigate what's going on....

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜