springMVC 乱码问题(和数据库无关)

springMVC 乱码问题(和数据库无关)

通常我们程序源代码都是UTF-8的,但是srpingMVC好像不是并不是,这个时候我们需要通过fitter来指定springMVC的编码

在web.xml中添加下面的过滤器

  <filter-name>characterEncodingFilterfilter-name>
  <filter-class>org.springframework.web.filter.CharacterEncodingFilterfilter-class>
  param>
    <param-name>encodingparam-name>
    <param-value>UTF-8param-value>
  param>
  param>
    <param-name>forceEncodingparam-name>
    <param-value>trueparam-value>
  param>
filter>
  <filter-mapping>
    <filter-name>characterEncodingFilterfilter-name>
    /*
  

你可能感兴趣的:(J2EE,SpringMVC)