<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