zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    restframework 自定义返回响应格式
    restframework 分页器
    Python设计模式
    Pytest系列
    Pytest系列
    Pytest系列 -pytest-dependency 用例依赖
    restframework jwt登录验证
    restframework 自定义json返回格式
    Axure RP8 注册码
    LVM 移除PV步骤
  • 原文地址:https://www.cnblogs.com/coisini/p/9715132.html
Copyright © 2011-2022 走看看