【发布时间】:2012-02-20 06:03:10
【问题描述】:
在我的示例应用程序中使用 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>
帮帮我。 提前谢谢...
【问题讨论】:
标签: tomcat jsf-2 navigation richfaces