hello1 web项目中web.xml作用分析

web.xml文件包含Facelets应用程序所需的几个元素。使用NetBeans IDE创建应用程序时,将自动创建以下所有内容。

  • 指定项目阶段的上下文参数:

        <context-param>
            <param-name>javax.faces.PROJECT_STAGE</param-name>
            <param-value>Development</param-value>
        </context-param>

    上下文参数提供Web应用程序所需的配置信息。应用程序可以定义自己的上下文参数。此外,JavaServer Faces技术和Java Servlet技术定义了应用程序可以使用的上下文参数。

  • 一个servlet元素及其servlet-mapping元素指定 FacesServlet所有带.xhtml后缀的文件都将匹配:

        <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>*.xhtml</url-pattern>
        </servlet-mapping>
  • 一个welcome-file-list元素指定着陆页的位置:

        <welcome-file-list>
            <welcome-file>index.xhtml</welcome-file>
        </welcome-file-list>

猜你喜欢

转载自www.cnblogs.com/my-worldlet/p/10590074.html
今日推荐