0
我的h:commandLink不起作用。我在faces-config.xml中有一個導航規則,在我的bean中有一個String方法doSave()。我不知道爲什麼它只是重新加載頁面而不跳入doSave()方法。jsf - commandLink不調用bean方法
JSF頁面
<h:form id="surveyForm">
<div class="srvButton">
<h:commandLink action="#{surveyBean.doSave}" value="#{msg.srvButton}" />
</div>
</h:form>
的面孔,配置
<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>
豆
public String doSave() {
// Kundendaten speichern
saveCustomer();
return "success";
}
我清理在JSF頁面美好景色的內容,但所有你需要知道是我認爲的形式和按鈕。
重新加載可能是轉換/驗證失敗的一個指標。你的表單中是否有'h:messages'標籤? – 2012-03-30 10:12:29
不,我在窗體中只有一些'h:selectOneRadio','t:inputText'和一個'h:dataTable'標記。我有一個類似的網頁,它有效,但我找不到差異 – 2012-03-30 10:51:08
然後嘗試添加'h:messages'。它顯示所有的驗證錯誤,你會對發生的事情有更多的瞭解。 – 2012-03-30 10:52:19