Spring 3表单数据不是utf-8编码
我的 Spring 3 项目配置了三个过滤器:encoding、spring-security、urlRewrite。我已经根据本文档完成了有关编码的所有操作:http://wiki.apache。 org/tomcat/FAQ/CharacterEncoding。但是,我无法正确获取字符串编码。因此,我需要进行编码转换以获得正确的编码。根据文档,解决这个问题唯一需要的就是utf-8过滤器。我测试过滤器。如果我删除过滤器或将其作为过滤器顺序中的第二个,则控制器上的请求编码将为空,响应编码将为 ISO-8859-1,而控制器上的请求编码为空,响应编码为 utf-8。 JSP 文件。并且删除过滤器对 POST 方法中的表单数据没有任何影响。
我没主意了。有什么遗漏的吗?
My Spring 3 project is configured with three filters: encoding, spring-security, urlRewrite. I have done all things needed in regarding of encoding according to this document: http://wiki.apache.org/tomcat/FAQ/CharacterEncoding. I, however, can't get the string encoding correctly. As a result, I need to make the encoding conversion to get the encoding right. According to the document, a utf-8 filter is the only thing needed to solve this problem. I test the filter. If I remove the filter or place it as the second in the filter order, the request encoding will be null and the response encoding will be ISO-8859-1 on a controller while request encoding is null and response encoding is utf-8 in a JSP file. And removing the filter has not any impact on the form data from the POST method.
I run out of idea. Anything missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没关系。我找到了这个问题的根源:Spring Tool Suite或STS。该代码在 STS 之外运行良好。
Never mind. I have found the source of this problem: Spring Tool Suite or STS. The code works fine outside of STS.