【问题标题】:JSF 2 can't find my xhml filesJSF 2 找不到我的 xhml 文件
【发布时间】:2013-05-16 14:52:15
【问题描述】:

我有一个 web jsf 项目,在我的网页目录中:

/WEB-INF  
/faces  
/res  
index.jsp  

我的 faces 目录得到了文件 all.xhtml 和 login.xhtml。

我的 web.xml

<servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*.xhtml</url-pattern>
</servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>/faces/login.jsp</welcome-file>
    </welcome-file-list>

但是当我运行我的项目时,JSF 找不到我的任何 xhtml 文件。我不明白为什么。

【问题讨论】:

    标签: java jsf-2 view web.xml


    【解决方案1】:

    根据this post,您必须像这样定义映射:

     <servlet-mapping>
         <servlet-name>Faces Servlet</servlet-name>
         <url-pattern>/faces/*</url-pattern>
     </servlet-mapping>
    

    或类似:

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

    另见:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-07
      • 1970-01-01
      • 2011-07-21
      • 2014-02-22
      相关资源
      最近更新 更多