2011-10-04 405 views
0

我在我的應用程序的一個使用JSF和情況如下:請求的資源不可用

1.I有一個pages文件夾下WEB_INF

2.Inside pagesa.jsp

3.當我使用本地tomcat部署此應用程序時,它說「請求的資源(/pages/a.jsp)不可用。」

<?xml version="1.0" encoding="UTF-8"?> 
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> 
     <display-name>Sample_Proj</display-name> 
     <welcome-file-list> 
      <welcome-file>index.html</welcome-file> 
      <welcome-file>index.htm</welcome-file> 
      <welcome-file>AddUser.jsp</welcome-file> 
      <welcome-file>default.html</welcome-file> 
      <welcome-file>default.htm</welcome-file> 
      <welcome-file>default.jsp</welcome-file> 
     </welcome-file-list> 
    </web-app> 

還有什麼我需要添加到web.xml? 下面的網址是我用什麼打的頁面: http://localhost:8080/Sample_Proj/WEB-INF/page/AddUser.jsp

回答

1

你的JSP文件/文件夾應該存在於Web項目的根,而不是在WEB-INF文件夾,即:

/pages/a.jsp
/WEB-INF/...

當涉及到JSF Web項目時,您的web.xml文件非常不完整。我會推薦閱讀Java EE 6教程,您可以通過this chapter閱讀有關Web應用程序入門的信息

相關問題