Spring MVC过滤器-字符集过滤器,解决中文乱码问题

post: 在web.xml

  
    CharacterEncodingFilter  
    org.springframework.web.filter.CharacterEncodingFilter  
      
        encoding  
        utf-8  
      
  
  
    CharacterEncodingFilter  
    /*  

get:在Tomcat中


也可以直接在web.xml中一次性修改


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

相当于

request.setCharacterEncoding("UTF-8");  
response.setCharacterEncoding("UTF-8");












你可能感兴趣的:(spring,mvc)