2012-02-23 80 views
0

我有以下web.xml。我的jsf標籤呈現良好的外部文件夾/頁面,但不在裏面。配置有問題嗎?未由FacesServlet呈現的JSF標記

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> 
    <context-param> 
     <param-name>javax.faces.PROJECT_STAGE</param-name> 
     <param-value>Development</param-value> 
    </context-param> 
    <servlet> 
     <servlet-name>Faces Servlet</servlet-name> 
     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>Faces Servlet</servlet-name> 
     <url-pattern>/faces/*</url-pattern> 
    </servlet-mapping> 
    <session-config> 
     <session-timeout> 
      30 
     </session-timeout> 
    </session-config> 
    <welcome-file-list> 
     <welcome-file>faces/GISPages/welcome.xhtml</welcome-file> 
    </welcome-file-list> 

    <resource-ref> 
     <res-ref-name>jdbc/Gis_WebApp</res-ref-name> 
     <res-type>javax.sql.DataSource</res-type> 
     <res-auth>Container</res-auth> 
    </resource-ref> 

    <resource-ref> 
     <res-ref-name>jdbc/SN</res-ref-name> 
     <res-type>javax.sql.DataSource</res-type> 
     <res-auth>Container</res-auth> 
    </resource-ref> 

    <security-constraint> 
     <web-resource-collection> 
      <web-resource-name>Protected Pages</web-resource-name> 
      <url-pattern>/fages/*</url-pattern> 
     </web-resource-collection> 
     <auth-constraint> 
      <role-name>registereduser</role-name> 
      <role-name>invitedguest</role-name> 
     </auth-constraint> 
    </security-constraint> 

    <login-config> 
     <auth-method>FORM</auth-method> 
     <realm-name>Live</realm-name> 
     <form-login-config> 
      <form-login-page>/login.xhtml</form-login-page> 
      <form-error-page>/noauth.xhtml</form-error-page> 
     </form-login-config> 
    </login-config> 

    <security-role> 
     <role-name>registereduser</role-name> 
    </security-role> 
    <security-role> 
     <role-name>invitedguest</role-name> 
    </security-role>  
</web-app> 

回答

2

通常是臉上的servlet的映射是基於文件擴展名:

<servlet-name>Faces Servlet</servlet-name> 
<url-pattern>*.jsf</url-pattern> 

<servlet-name>Faces Servlet</servlet-name> 
<url-pattern>*.xhtml</url-pattern> 

你的映射僅適用於面的子文件夾。

2

請在 welcome-file-list標籤中給出歡迎文件的完整預定義路徑。就像我提到的

<welcome-file-list> 
    <welcome-file>/company/dashboard.xhtml</welcome-file> 
</welcome-file-list>