【问题标题】:Error "outcome is not defined" in JSF navigationJSF 导航中的错误“未定义结果”
【发布时间】:2015-05-05 07:06:18
【问题描述】:

我正在尝试学习 JSF,但无法从一个页面导航到另一个页面:

我的面孔 config.xml 如下:

<?xml version="1.0" encoding="UTF-8"?>

<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">

    <managed-bean>
        <managed-bean-name>hello1</managed-bean-name>
        <managed-bean-class>hello.Hello</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
 <navigation-rule>
    <from-view-id>index.xhtml</from-view-id>
    <navigation-case>
        <from-action>#{hello.getworld}</from-action>
        <from-outcome>root</from-outcome>
        <to-view-id>1.xhtml</to-view-id>
    </navigation-case>
        </navigation-rule>  
</faces-config>

你好豆在下面:

package hello;

import javax.faces.bean.ManagedBean;

@ManagedBean
public class Hello {

    final String world = "root";

    public String getworld() {
        return world;
    }
}

意思是“结果未定义”。我不知道如何正确导航。

【问题讨论】:

    标签: jsf jsf-2


    【解决方案1】:

    看看 mkyong 的Implicit Navigation in JSF。我想你会在那里找到你的答案。

    如果您想了解更多有关 JSF-Naviagtion 的信息,请尝试以下链接:JSF - Page Navigation

    如果有任何不清楚的地方,请随时发表评论。

    【讨论】:

    • 您的 bean 名称是 hello1,而在导航中您使用了 hello。
    猜你喜欢
    • 1970-01-01
    • 2017-09-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-31
    • 1970-01-01
    • 2019-07-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多