<h:commandButton action>
在以下代码中不起作用。
豆(Employee.java): -
public String deleteEmployee(){
return "success3";
}
JSF页面(delete-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>
第二个导航规则不起作用,但第一个导航规则正在运行。 提前谢谢。
答案 0 :(得分:1)
employee
中的拼写错误<from-view-id>
。
<from-view-id>/delete-employee.xhtml</from-view-id>