写博客杂记

  1. springmvc RequestParam中文乱码
    在xml里添加
<filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
        <param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>


  1. @RequestParam(value=”topic”, required=false)

不加required=false会报topic not represent的错误

posted @ 2017-01-16 15:03  StevenLuke  阅读(91)  评论(0编辑  收藏  举报