我的JSF Web应用程序显示以下错误:
在ExternalContext中找不到/index.xhtml作为资源.
我的目录结构是:
- Java Resource -- src --- br.com.k19.controle ---- NumeroAleatorioBean.java --- resources - JavaScript Resources - build - WebContent -- META-INF -- Web Pages --- index.xhtml --- formulario.xhtml -- Web-Inf
我需要把我/index.xhtml的这个结构放在哪里?
Bal*_*usC 16
该WebContent文件夹代表Web内容.您将index.xhtml文件放在Web Pages子文件夹中,以便正确的URL
http://localhost:8080/ProjectName/Web Pages/index.xhtml
Run Code Online (Sandbox Code Playgroud)
因此不是
http://localhost:8080/ProjectName/index.xhtml
Run Code Online (Sandbox Code Playgroud)
正如你所期待的那样.
如果你想拥有它的上下文根,刚摆脱了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
Run Code Online (Sandbox Code Playgroud)
注意:Java区分大小写.Web-Inf绝对不一样WEB-INF.小心,否则你会有安全漏洞.
| 归档时间: |
|
| 查看次数: |
48349 次 |
| 最近记录: |