在我的示例应用程序中使用 JSF2.0 + richfaces3.3.3 + tomcat6.0.29。
我的没有重定向的导航案例在 IE 中不起作用。 但是其他浏览器可以。
当我添加 redirect 标签时,页面导航在所有浏览器中工作。
JSF1.2,我没有使用重定向,页面导航在所有浏览器中都可以正常工作。
为什么JSF2.0需要重定向标签?
我的jsp文件位置webpages/design/first.jsp和webpages/design/second.jsp
faces-config.xml
....
....
<managed-bean>
<managed-bean-name>First</managed-bean-name>
<managed-bean-class>sample.First</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/design/first.jsp</from-view-id>
<navigation-case>
<from-outcome>go_secondpage</from-outcome>
<to-view-id>/design/second.jsp</to-view-id>
</navigation-case>
</navigation-rule>
....
webpages/design/first.jsp
<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>First Page</title>
</head>
<body>
<h:form id="sampleForm">
<h:panelGrid cellpadding="10" cellspacing="10">
<h:outputText value="You are in first page"/>
<a4j:commandButton value="GO-SecondPage" action="#{First.goSecondPage}"/>
</h:panelGrid>
</h:form>
</body>
</html>
First.java
package sample;
public class First
{
public String goSecondPage()
{
String message = "go_secondpage";
return message;
}
}
webpages/design/second.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Seocnd Page</title>
</head>
<body>
<h1>Welcome second page</h1>
</body>
</html>
帮帮我。 提前致谢...
最佳答案
您正在使用对 JSF2 检查支持有限的 richfaces 版本 link .删除 richfaces 标签,使用纯 JSF 命令按钮标签并检查,如果将 richfaces 与 JSF2 一起使用,则使用版本 4.x。这不是 JSF 问题。另请参阅您根据 JSF 版本使用了正确的 faces-config.xml。
关于tomcat - JSF 导航案例在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9030075/