2012-02-14 137 views
2

我正在使用Eclipse Indigo开发我的JSF 2.0 Web应用程序。我使用JSF 2.0和JSTL 1.2库创建了一个动态Web项目。有一些Facelet文件。欢迎文件是login.xhtml警告:有人试图访问安全资源:/WEB-INF/login.xhtml

部署项目,每当我在Tomcat的7.0.11运行login.xhtml后,我得到了浏览器中出现以下错误:

HTTP Status 404
type Status report
message
description The requested resource() is not available.
Apache Tomcat/7.0.11

在Eclipse的Tomcat控制台,我得到以下错误:

**Feb 14, 2012 1:08:59 PM org.apache.catalina.startup.Catalina start 
INFO: Server startup in 4693 ms 
Feb 14, 2012 1:09:14 PM javax.faces.webapp.FacesServlet service 
WARNING: Someone is trying to access a secure resource : /WEB-INF/login.xhtml 
remote address is 0:0:0:0:0:0:0:1 
remote host is 0:0:0:0:0:0:0:1 
remote user is null 
request URI is /Test/faces/WEB-INF/login.xhtml 

web.xml是由Eclipse生成的默认值,但是我已经在其中更改了欢迎文件名。

这个错误是怎么造成的?我该如何解决?

回答

2

/WEB-INF文件夹中的资源不能公开访问。该文件夹应专门用于配置文件(如web.xml)和您不希望最终用户能够下载和查看的模板/包含文件。

您需要将login.xhtml文件移动到/WEB-INF文件夹之外并将请求URI更改为/Text/faces/login.xhtml

+0

ohhhh对不起,我的愚蠢但知识渊博的错误...谢谢....你救了我... – 2012-02-16 21:54:17

+0

不客气。 – BalusC 2012-02-16 22:13:57