2012-02-14 143 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