我目前无法从浏览器网址中公开我的JSF文件。我的项目结构如下:
<PROJECT_NAME>
--->WebContent
--->index.xhtml
--->subfolder1
--->subjsf.xhtml
--->subfolder2
--->subjsf.xhtml
--->subfolder3
--->subjsf.xhtml
这是我的web.xml:
<?xml version="1.0"?>
<web-app version="3.0" 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-app_3_0.xsd">
<display-name>PROJECT_NAME</display-name>
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>blueSky</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/pages/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
我的脸 - 配置:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude"
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">
<navigation-rule>
<from-view-id>/index.xhtml</from-view-id>
<navigation-case>
<from-outcome>subfolder1</from-outcome>
<to-view-id>/subfolder1/subjsf.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
<application>
<resource-bundle>
<base-name>resources</base-name>
<var>msgs</var>
</resource-bundle>
</application>
</faces-config>
不使用重定向,似乎工作正常。但启用重定向会出现此错误:
com.sun.faces.context.FacesFileNotFoundException: /subjsf.xhtml Not Found in ExternalContext as a Resource
当您直接访问此网址时,请执行以下操作:<hostname>:<port>/PROJECT_NAME/subfolder1/subjsf.xhtml it also gave the same error above.
我想启用URL的重定向以刷新并显示当前页面名称。另外,有没有办法在子文件夹中使用隐式导航?
真的很感谢你们的帮助!提前谢谢你......
答案 0 :(得分:2)
只要内容不在WEB-INF下,客户就可以直接访问所有内容。
以下是一些排查提示:
xhtml
个内容?最后,您可以转到部署目录,将WAR复制到单独的文件夹,对其进行缩减并检查其内容是否符合您的预期。