0
votes

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.

1
Reload might be an indicator that conversion/validation failed. Do you have a h:messages tag in your form? - Matt Handy
No, I've just some h:selectOneRadio, t:inputText and one h:dataTable tag within the form. I've got an similar webpage and there it works, but I can't find the differences - yves.beutler
Then try to add h:messages. It displays all validation errors and you will get more insight on what happens. - Matt Handy
I haven't got any validation methods yet, but I'll implement them as soon as I can. The error must be in a different place - yves.beutler
Did you try to run your code with the messages tag? Even if you have no validation methods, at least conversion will be performed. Can you verify that your action method is called at all (debug)? - Matt Handy

1 Answers

0
votes

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..