简体   繁体   English

错误:在ExternalContext中找不到/login.xhtml作为资源

[英]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个错误。

  1. /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文件夹之外。

  2. /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. 应该做。

See also: 也可以看看:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 login.xhtml:请求的资源不可用 - login.xhtml: The requested resource is not available 错误:在ExternalContext中找不到/JavaServerFaces/default.xhtml作为资源 - Error: /JavaServerFaces/default.xhtml Not Found in ExternalContext as a Resource 404 /index.xhtml在ExternalContext中找不到作为资源 - 404 /index.xhtml Not Found in ExternalContext as a Resource 在ExternalContext中找不到/index.xhtml作为资源 - /index.xhtml Not Found in ExternalContext as a Resource welcome-file index.xhtml提供“在ExternalContext中找不到”作为资源 - welcome-file index.xhtml gives Not Found in ExternalContext as a Resource IntelliJ项目错误“在外部上下文中找不到/hello.xhtml作为资源” - IntelliJ project errors “/hello.xhtml Not Found in ExternalContext as a Resource” XML解析错误:找不到元素位置:http:// localhost:8081 / web-app / pages / login.xhtml行号1,列1:^ - XML Parsing Error: no element found Location: http://localhost:8081/web-app/pages/login.xhtml Line Number 1, Column 1: ^ HTTP状态404-(projectName)/faces/Login.xhtml-请求的资源不可用 - HTTP Status 404 - (projectName)/faces/Login.xhtml - the requested resource not available 错误渲染视图 [/login.xhtml]: java.lang.NullPointerException 在启动服务器 PF10 - Error Rendering View[/login.xhtml]: java.lang.NullPointerException on starting server PF10 com.sun.faces.context.FacesFileNotFoundException:/protected-area/index.xhtml在ExternalContext中找不到作为资源 - com.sun.faces.context.FacesFileNotFoundException: /protected-area/index.xhtml Not Found in ExternalContext as a Resource
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM