<?xml version="1.0" encoding="UTF-8"?> //xml的版本:1.0 和 编码:utf-8
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> <context-param> <param-name>javax.faces.PROJECT_STAGE</param-name> <param-value>Development</param-value> //该元素用来声明应用范围(整个WEB项目)内的上下文初始化参数。param-name 设定上下文的参数名称。必须是唯一名称。param-value 设定的参数名称的值 </context-param> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> //<servlet-name> 这个是我们要注册servlet的名字,一般跟Servlet类名有关
<servlet-class> 这个就是指向我们要注册的servlet 的类地址, 要带包路径以上两个包在一个servlet 节点之下.
<load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> //是用来配置我们注册的组件的访问路径,里面包括两个节点 <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.xhtml</url-pattern> </servlet-mapping> <session-config> <session-timeout> //设置时间 30 </session-timeout> </session-config> <welcome-file-list> //制定首页 <welcome-file>index.xhtml</welcome-file> </welcome-file-list></web-app>原文:https://www.cnblogs.com/tily123/p/10634082.html