web项目中如何设置web.xml文件

 时间:2024-10-13 04:37:36

1、<display-name>ZHCity</display-name>,在<display-name>中设置需要显示的项目名称

web项目中如何设置web.xml文件

2、<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/ApplicationContext.xml</param-value> </context-param>在其中配置spring框架的spring配置文件

web项目中如何设置web.xml文件

3、<context-param> <param-name>log4jConfigLocation</para罪焐芡拂m-name> <param-value>classpath:log4j.properties</param-value> </context-param>配置日志,方便在项目启动的时候记录日志。

web项目中如何设置web.xml文件

4、<init-param> <param-name>encoding</param-name> <param-value>utf-8</param-value> </init-param>配置过滤器,设置为utf-8的格式,使得在不同的浏览器中汉字不会出现乱码。

web项目中如何设置web.xml文件

5、<filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>配置拦截器需要拦截的url,/*表示需要拦截所有的路径。

web项目中如何设置web.xml文件

6、<error-page> <error-code>404</error-code> <location>/404.jsp</location> </error-page>配置一个通用的页面出来地址,方便在出现错误 的时候跳转至统一的界面。

web项目中如何设置web.xml文件
  • 古剑奇谭如何刷经验升级
  • 英灵神殿建造房子方法
  • 太吾绘卷人力有什么用
  • 热门搜索
    八十天环游地球手抄报 安全伴我行手抄报资料 与法同行手抄报内容 春手抄报 关于自信的手抄报 讲卫生手抄报 母爱手抄报内容 杜绝浪费手抄报 运动手抄报图片 有关写字的手抄报