jsp到controller乱码

1:jsp页面的from表单没有写提交方式method="post"
 
2:没有在web.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>
    <init-param>
      <param-name>forceEncoding</param-name>
      <param-value>true</param-value>
    </init-param>
  </filter>
  <filter-mapping>
   <filter-name>encodingFilter</filter-name>
   <url-pattern>/*</url-pattern>
  </filter-mapping>

  

 
3:window.localtion.href跳转到controller,参数出错
   1) jsp页面:
  
  window.location.href = "/loan7/casesController/searchForm.do?caseNo="+caseNo+"&productTypeName="+decodeURI(decodeURI(productTypeName));
 
    2)controller层
productTypeName = new String(productTypeName.getBytes("ISO-8859-1"),"UTF-8");
 
4:jsp通过ajax传递中文参数报错
修改tomcat  配置文件conf  下的server.xml

posted on 2018-09-27 19:39  爪哇玛咖  阅读(531)  评论(0编辑  收藏  举报

导航