[英]Error: /login.xhtml Not Found in ExternalContext as a Resource
I'm using JBoss 7.1 with JSF 2.1/Prime Faces and keep running into the error listed in the title. 我正在使用JBoss 7.1和JSF 2.1 / Prime Faces并继续遇到标题中列出的错误。 I've tried many of the suggestions made here and all end up with the same error. 我已经尝试了很多这里提出的建议,但最终都出现了同样的错误。
File structure is: 文件结构是:
WEB-INF
faces
login.xhtml
I have the following in web.xml: 我在web.xml中有以下内容:
<display-name>clientAccountManager</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
I am accessing the file currently using the following URL: 我正在使用以下URL访问该文件:
http://localhost:8080/clientAccountManager/faces/login.xhtml
I have also changed the URL pattern to *.xhtml and used: 我还将URL模式更改为* .xhtml并使用:
http://localhost:8080/clientAccountManager/login.xhtml
with the same result. 结果相同。
What am I missing? 我错过了什么?
You made 2 mistakes. 你犯了2个错误。
/WEB-INF
folder is for configuration files, include files, template files, tag files, etc, which are supposed to be hidden from direct access, not for publicly accessible files. /WEB-INF
文件夹用于配置文件,包含文件,模板文件,标记文件等,它们应该被隐藏而不能直接访问,而不能用于公共可访问的文件。 Put publicly accessible files outside /WEB-INF
folder. 将可公开访问的文件放在/WEB-INF
文件夹之外。
/faces
folder should not be used at all. /faces
文件夹根本不应该使用。 A virtual /faces/*
URL pattern on FacesServlet
doesn't imply that you should have a physical folder like that. FacesServlet
上的虚拟/faces/*
URL模式并不意味着您应该拥有这样的物理文件夹。 Remove it. 去掉它。
So, all with all, just 所有,只有
WebContent
|-- META-INF
|-- WEB-INF
| |-- faces-config.xml
| `-- web.xml
`-- login.xhtml
and 和
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
and 和
http://localhost:8080/clientAccountManager/login.xhtml
should do. 应该做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.