zoukankan      html  css  js  c++  java
  • js、java传值编码

    一、请求使用post方法不需要考虑编码问题。
    二、前后台统一编码,支持中文,不考虑编码;tomcat utf-8编码
    三、前后台编码不统一
     $.ajax({
                    url : "maintain/saveResourceInfoDESAction.action?imagePath="+imagePath,
                    type : 'get',// 数据发送方式
                    data:{"fTitle":fTitle,"htmlContent":htmlContent,"titleImgs":inputTitle.toString()},
                    async : true, //异步
                    dataType : 'json',
                    success : this.saveResInfoSuccess,
                    error: function(){alert('发表失败');}
                });

    imagePath  在 url中 需要  两次编码  encodeURI(encodeURI(imagePath));后台imagePath = URLDecoder.decode(imagePath,"UTF-8"); 才能取得正确值;
    fTitle  只需一次编码  encodeURI(fTitle)  后台imagePath = URLDecoder.decode(fTitle,"UTF-8"); 就可以取得正确值

    作者:robert
    出处:http://www.cnblogs.com/robertsun/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
    如果文中有错误,欢迎指出。以免更多的人被误导。
    欢迎留言交流。
  • 相关阅读:
    .net Core 配置Centos守护进程Supervisor
    .net Core 安装在linux上
    Mariadb Galera Cluster 搭建集群
    MariaDB 安装配置记录
    MariaDB 安装
    wso2 linux上部署说明
    RestFul 架构详解
    SpirngBoot之整合邮件服务
    SpringBoot之模板引擎
    SpringBoot之持久化框架
  • 原文地址:https://www.cnblogs.com/robertsun/p/4149986.html
Copyright © 2011-2022 走看看