• web.xml文件的简单说明


    在javaEE提供的tutorial中的hello1中的web.xml文件写到:

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <web-app version="3.1" 
     3          xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
     4          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     5          xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
     6     <context-param>
     7         <param-name>javax.faces.PROJECT_STAGE</param-name>
     8         <param-value>Development</param-value>
     9     </context-param>
    10     <servlet>
    11         <servlet-name>Faces Servlet</servlet-name>
    12         <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    13         <load-on-startup>1</load-on-startup>
    14     </servlet>
    15     <servlet-mapping>
    16         <servlet-name>Faces Servlet</servlet-name>
    17         <url-pattern>*.xhtml</url-pattern>
    18     </servlet-mapping>
    19     <session-config>
    20         <session-timeout>
    21             30
    22         </session-timeout>
    23     </session-config>
    24     <welcome-file-list>
    25         <welcome-file>index.xhtml</welcome-file>
    26     </welcome-file-list>
    27 </web-app>

    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>
  • 相关阅读:
    一生不可错过的五句话
    分布式缓存系统Memcached简介与实践[转]
    telnet serverip serverport 可以测试服务器端口是否通
    使用c#生成高品质小空间的缩略图
    sql server2005对tsql的增强之在聚合函数的后面使用over关键字
    (转)让你受益终身的10个Word实用技巧
    sql取所有记录中每天的最后一笔交易的记录
    屏蔽服务器端包含在文件不存在时报错的错误信息
    c#农历日历类
    Niubility 英语教程
  • 原文地址:https://www.cnblogs.com/formyfish/p/10555583.html
Copyright © 2020-2023  润新知