SpringMVC乱码问题解决

第一步:web.xml添加过滤器

  
    
        characterEncodingFilter  
        org.springframework.web.filter.CharacterEncodingFilter  
          
            encoding  
            UTF-8  
          
          
            forceEncoding  
            true  
          
     
     
        characterEncodingFilter  
        /*  
    

第二步:添加 produces = "application/json;charset=utf-8" 或 produces = "text/html;charset=utf-8"

@RequestMapping(produces = "application/json;charset=utf-8")
@RequestMapping(produces = "text/html;charset=utf-8")

 最后重启服务器

 

你可能感兴趣的:(SpringMVC)