一个关于简单jsf页面跳转的问题
<?xml version= "1.0 "?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN "
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd ">
<faces-config>
<!-- <navigation-rule>
<description> Navigation from the hello page. </description>
<from-view-id> /hello.jsp </from-view-id>
<navigation-case>
<from-outcome> success </from-outcome>
<to-view-id> /goodbye.jsp </to-view-id>
</navigation-case>
</navigation-rule> -->
<navigation-rule>
<from-view-id> /hello.jsp </from-view-id>
<navigation-case>
<from-outcome> login </from-outcome>
<to-view-id> /goodbye.jsp </to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<description> The one and only HelloBean. </description>
<managed-bean-name> user </managed-bean-name>
<managed-bean-class> org.jia.hello.HelloBean
</managed-bean-class>
<managed-bean-scope> session </managed-bean-scope>
</managed-bean>
</faces-config>
index.jsp
<%@page contentType= "text/html "%>
<%@page pageEncoding= "gbk "%>
<%@taglib prefix= "f " uri= "http://java.sun.com/jsf/core "%>
<%@taglib prefix= "h " uri= "http://java.sun.com/jsf/html "%>
<html> <head> <title> wewe </title>
</head> <body>
<f:view>
<h:form>
<h3> 請輸入您的名稱 </h3>
名稱: <h:inputText value= "#{user.name} "/> <p>
<h:commandButton value= "送出 " action= "login "/>
</h:form>
</f:view>
</body>
</html>
现在我用faces/index.jsp访问时点击按钮怎么也跳不到hello.jsp上,请问是怎么回事,我看ie的查看源文件解析后form里的action竟成/jstSimpleTest/faces/index.jsp了,这是怎么回事啊,怎么解决呢
[解决办法]
在face-config里增加导航规则,如下:
<navigation-rule>
<from-view-id> /index.jsp </from-view-id>
<navigation-case>
<from-outcome> login </from-outcome>
<to-view-id> /hello.jsp </to-view-id>
</navigation-case>
</navigation-rule>
[解决办法]
你能不能说的清楚点啊?一会hello.jsp,一会又index.jsp的,程序的初始页面是哪个阿?到底有没有hello.jsp阿?如果没有的话,把导航规则里的hello.jsp改成index就可以了,如果2个都有的话,就要按照 ( mxm_1123(无名) ( ) 信誉:100 )
所说的做就对了。