博客
关于我
Tomcat+Springmvc中文乱码问题解决方法
阅读量:560 次
发布时间:2019-03-09

本文共 687 字,大约阅读时间需要 2 分钟。

SpringMVC编码配置及乱码解决方案

请求时参数变乱码

在SpringMVC应用中,参数乱码问题常常与字符编码不当有关。为了避免此类问题,可以通过web.xml配置CharacterEncodingFilter进行处理。

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

返回到浏览器中文显示成乱码

确保返回数据的编码格式正确也是关键。

    response.setContentType("text/html; charset=UTF-8");

上述配置方法能够有效解决参数乱码问题,同时确保页面内容的正确显示。

转载地址:http://sgfpz.baihongyu.com/

你可能感兴趣的文章
python glob.glob使用
查看>>
python glob的安装和使用
查看>>
Python google drive API 下载,文件在哪里?
查看>>
Python GPS 模块:读取最新的 GPS 数据
查看>>
python grpc入门
查看>>
python gRPC测试helloworld
查看>>
python gRPC简单示例
查看>>
Python GUI 开发:全面指南
查看>>
Python GUI编程
查看>>
Python进阶语法:列表推导式
查看>>
Python hashlib模块
查看>>
python hashlib模块
查看>>
python if,循环的练习
查看>>
Python in open course (week3)
查看>>
Python IO编程
查看>>
Python IO编程详解
查看>>
Python IPL
查看>>
python join split
查看>>
python json文件传输图片
查看>>
python kivy AttributeError:‘super‘对象没有属性‘__getattr__‘
查看>>