formsjsfjavabeanscommandlink

jsf - commandLink doesn't call bean method


My h:commandLink doesn't work. I've got a navigation rule in the faces-config.xml and a String method doSave() in my bean. I don't know why It only reloads the page without jumping into the doSave() method.

jsf-page

<h:form id="surveyForm">
    <div class="srvButton">
        <h:commandLink action="#{surveyBean.doSave}" value="#{msg.srvButton}" />
    </div>
</h:form>

faces-config

<navigation-rule>
    <from-view-id>/pages/survey.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>success</from-outcome>
        <to-view-id>/pages/surveyFinish.xhtml</to-view-id>
    </navigation-case>
</navigation-rule>

bean

public String doSave() {

    // Kundendaten speichern
    saveCustomer();     

    return "success";
}

I cleaned the content in the jsf-page for a better view, but all you need to know is the form and button I think.


Solution

  • I just solved my problem. I replaced all my c:if tags with ui:fragment tags and it worked! Maybe, this could interest you c:foreach vs ui:repeat Thanks @matthandy for his effort..