1
votes

I have problem with jsf <h:commandButton> with <f:ajax> tag. If it has <f:ajax> tag, it calls other action and actionListener methods in the backing bean. If it doesn't have the <f:ajax> tag it calls its own right action method. here is my snippet:

 <h:form>
    <h:panelGroup id="loanContent" layout="block">
        <ui:include src="#{mainView.typePage}.xhtml"/>
    </h:panelGroup>
    <h:commandButton id ="rLoanBtn" value="Create" action="#{mainView.createNewType}">
        <f:ajax execute="loanContent" render="@form"/>
    </h:commandButton>  
 </h:form>

if I omit <f:ajax execute="loanContent"/> part, it works fine. If I leave as it is, it calls other methods which are responsible for other buttons of the same form. Btw mainView backing bean is a ViewScoped managed bean.

1
Did you try to change execute attribute to something including commandButton in question? Like execute="@this" or "@form" to begin with?mrembisz
The dynamic include is causing that. Which JSF impl/version?BalusC
@BalusC After several experiments. I knew that it is not dynamic include. But It calls other methods whatever these methods are before its actual method. I'm using Mojarra 2.1.23 and 2.1.24 is same.Odgiiv
It goes through other method which is tied to another commandButton component in same view before its own action method.Odgiiv

1 Answers

5
votes

I have found out cause. If I have <type = "button"> attribute with other buttons, it goes through methods that is bind to other buttons before its actual method. So I omitted it then it works fine.