【发布时间】: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;
}
}
意思是“结果未定义”。我不知道如何正确导航。
【问题讨论】: