Java项目xml相关配置
一、web.xml
设置会话过期时间,这里单位是分钟
<session-config> <session-timeout>30</session-timeout> </session-config>
过滤器
<filter> <filter-name>CharacterEncodingFilter</filter-name> <filter-class>yycg.base.filter.EncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>CharacterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
监听器
<listener> <listener-class>com.dengfeng.SessionListener</listener-class> </listener> <listener> <listener-class>com.dengfeng.OnlineUserListener</listener-class> </listener>
servlet配置
<servlet> <servlet-name>FileUpload</servlet-name> <servlet-class>com.deng.FileUpload</servlet-class> </servlet> <servlet-mapping> <servlet-name>FileUploadd</servlet-name> //这个地方如果是写路径表示前端请求交给servlet-name对应的servlet-class处理,如果是写*.do,表示所有的请求交个servlet处理 <url-pattern>/deng/FileUpload</url-pattern> </servlet-mapping>
设置默认访问页面
<welcome-file-list> <welcome-file>search.html</welcome-file> </welcome-file-list>