web.xml常用配置
servlet配置:
<servlet> <servlet-name>test</servlet-name> <servlet-class>TestServlet</servlet-class> <init-param> <param-name>email</param-name> <param-value>1@163.com</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>test</servlet-name> <url-pattern>/test.do</url-pattern> </servlet-mapping>
filter配置:
<filter> <filter-name>Filter</filter-name> <filter-class>FilterClass</filter-class> <init-param> <param-name>size</param-name> <param-value>20</param-value> </init-param> </filter> <filter-mapping> <filter-name>Filter</filter-name> <url-pattern>/comment</url-pattern> </filter-mapping>
上下文初始化参数配置:
<context-param> <param-name>email</param-name> <param-value>1@163.com</param-value> </context-param>
listener配置:
<listener> <listener-class> com.demo.MyListener </listener-class> </listener>
session配置:
<session-config> <session-timeout>15</session-timeout> </session-config>
为jsp配置初始化参数:
<servlet> <servlet-name>test</servlet-name> <jsp-file>/test.jsp</jsp-file> <init-param> <param-name>email</param-name> <param-value>1@163.com</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>test</servlet-name> <url-pattern>/test.jsp</url-pattern> </servlet-mapping>
jsp属性配置:
<jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <scripting-invalid>true</scripting-invalid> <el-ignored>true</el-ignored> </jsp-property-group> </jsp-config>
配置欢迎页面:
<welcome-file-list> <welcome-file>index.html</welcome-file> <welcom-file>default.jsp</welcome-file> </welcome-file-list>