[英]/index.xhtml Not Found in ExternalContext as a Resource
My JSF web application shows the following error: 我的JSF Web应用程序显示以下错误:
/index.xhtml Not Found in ExternalContext as a Resource. 在/ ExternalContext中找不到/index.xhtml作为资源。
My directory structure is: 我的目录结构是:
- Java Resource -- src --- br.com.k19.controle ---- NumeroAleatorioBean.java --- resources - JavaScript Resources - build - WebContent -- META-INF -- Web Pages --- index.xhtml --- formulario.xhtml -- Web-Inf
Where do I need to put my /index.xhtml
in this structure? 我需要在哪里将/index.xhtml
放在此结构中?
The WebContent
folder represents the web content. WebContent
文件夹代表Web内容。 You placed the index.xhtml
file inside Web Pages
subfolder so the right URL would be 您将index.xhtml
文件放置在Web Pages
子文件夹中,因此正确的URL为
http://localhost:8080/ProjectName/Web Pages/index.xhtml
and thus not 因此没有
http://localhost:8080/ProjectName/index.xhtml
as you seemed to expect. 如您所料。
If you want to have it on the context root, just get rid of the Web Pages
folder altogether and move those .xhtml
files directly inside WebContent
folder, in the same level as META-INF
and WEB-INF
: 如果要在上下文根目录中放置它,只需完全删除Web Pages
文件夹,然后将那些.xhtml
文件直接移到WebContent
文件夹中,与META-INF
和WEB-INF
处于同一级别:
ProjectName
|-- Java Resources
| `-- src
| `-- br.com.k19.controle
| `-- NumeroAleatorioBean.java
|-- resources
|-- JavaScript Resources
|-- build
`-- WebContent
|-- META-INF
|-- WEB-INF
| |-- faces-config.xml
| `-- web.xml
|-- index.xhtml
`-- formulario.xhtml
Note: Java is case sensitive. 注意:Java区分大小写。 Web-Inf
is definitely not the same as WEB-INF
. Web-Inf
绝对不同于WEB-INF
。 Be careful or you'll have a security hole. 请当心,否则您将有安全漏洞。
I faced this issue recently. 我最近遇到了这个问题。 I tried cleaning the Tomcat Work Directory, Clean , and Publish . 我尝试清理Tomcat Work Directory,然后清理和发布 。 After that, when I started the server, the application was running smooth. 之后,当我启动服务器时,应用程序运行平稳。
For independent tomcat server, clean dir --> temp, work, and inside webApp directory, remove all the existing unarchived project. 对于独立的tomcat服务器,请清理dir-> temp,work,并在webApp目录中, 删除所有现有的未归档项目。 Restart the Tomcat, it worked for me. 重新启动 Tomcat,它对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.