<h:commandButton action>
在下面的代碼片段中不起作用。JSF <h:commandButton action> not working
豆(Employee.java): -
public String deleteEmployee(){
return "success3";
}
JSF頁面(刪除-employee.xhtml): -
<h:form>
<h:commandButton action="employee.deleteEmployee" type="submit" value="delete"/>
</h:form>
faces-config.xml中: -
<managed-bean>
<description>Employee navigation</description>
<managed-bean-name>employee</managed-bean-name>
<managed-bean-class>erpJavaFiles.Employee</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/add-Employee.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/CRM.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>failure</from-outcome>
<to-view-id>/home.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/delete-employee.xhtml</from-view-id>
<navigation-case>
<from-outcome>success3</from-outcome>
<to-view-id>/CRM.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
第二個導航規則不起作用,但第一個導航規則正在運行。 在此先感謝。
爲什麼你還在使用'faces-config.xml'方法? JSF 2.0爲託管的bean和隱式導航提供了註釋。 http://blogs.sun.com/rlubke/entry/faces_config_xml_we_don無論如何,'action'屬性中缺失的EL'#{}'也是一個「錯字」,對吧? – BalusC 2011-05-07 03:20:08
V v v感謝BalusC.But你提供的鏈接不起作用,請重新發送。 – Adnan 2011-05-07 04:51:00
頁面已關閉。同時,請參閱http://www.coreservlets.com/JSF-Tutorial/jsf2/index.html#Basics - 全方位的實用JSF教程。 – 2011-05-07 04:55:37