1。在web.xml添加过滤器:

<filter>
<filter-name>SpringCharacterEncoding</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>SpringCharacterEncoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

2.spring-mvc 配置文件,配置自动扫描时:

    <mvc:annotation-driven>
<mvc:message-converters register-defaults="true">
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>text/json;charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>

3.post提交就没问题,而get可能还需要在方法上@RequestMapping注解添加produces参数

@RequestMapping(value="/selectPlaceListMap",produces = "text/html;charset=UTF-8")

4.以上不行,就修改eclipse自身配置的servers底下的server.xml

文件

修改:

<Connector URIEncoding="UTF-8" connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>

没有则添加,实际运行环境更改tomcat的server.xml即可。

spring mvc 表单提交 乱码的更多相关文章

  1. Spring MVC表单提交

    实际应用中,列表中的单条记录的修改,可能需要传很多对象参数到后台服务器,Spring MVC表单标签<form:> 提供了一种简洁的提交方式. <form id="form ...

  2. [Spring MVC] - 表单提交

    Spring MVC自带的表单标签比较简单,很多时候需要借助EL和JSTL来完成. 下面是一个比较简单的表单提交页面功能: 1.User model package com.my.controller ...

  3. Spring MVC表单提交中文数据出现乱码

    http://jiessiedyh.iteye.com/blog/475541 http://bigcat.easymorse.com/?p=474 Spring MVC 教程,快速入门,深入分析 h ...

  4. [Spring MVC] 表单提交日期转换问题,比如可能导致封装实体类时400错误

    三种格式的InitBinder @InitBinder//https://stackoverflow.com/questions/20616319/the-request-sent-by-the-cl ...

  5. Spring MVC - 表单处理示例

    环境搭建 环境: Intellij IDEA Spring MVC 完整的项目文件结构如下所示: Student.java package com.ktao.controller; public cl ...

  6. Spring MVC表单处理

    以下示例演示如何编写一个简单的基于Web的应用程序,它使用Spring Web MVC框架使用HTML表单. 首先使用Eclipse IDE,并按照以下步骤使用Spring Web Framework ...

  7. 使用Spring MVC表单标(转)

    概述     在低版本的Spring中,你必须通过JSTL或<spring:bind>将表单对象绑定到HTML表单页面中,对于习惯了Struts表单标签的开发者来说,Spring MVC的 ...

  8. Spring MVC表单标签

    从Spring 2.0开始,Spring MVC开始全面支持表单标签,通过Spring MVC表单标签,我们可以很容易地将控制器相关的表单对象绑定到HTML表单元素中. form标签     和使用任 ...

  9. spring mvc表单form值自动传到javabean-注解@ModelAttribute

    直接通过Form Bean进行表单可以简化表单提交的处理,特别是对于复杂表单,过于简单的表单就不建议了,因为毕竟需要额外创建一个Form Bean.前段时间项目中有一个比较复杂的表单,有多层次而且涉及 ...

随机推荐

  1. 题解【luogu1073 最优贸易】

    Solution 考虑原图是 DAG 时怎么做. 拓扑排序 + dp ,令 dp[i] 表示 \(1\) 到 \(i\) 的路径上最小的卖出价格.转移方程就是对每一个可以到达这个点的 dp 取个 mi ...

  2. [Coding Practice] Maximum number of zeros in NxN matrix

    Question: Input is a NxN matrix which contains only 0′s and 1′s. The condition is no 1 will occur in ...

  3. CSS hack浏览器兼容一览表

    CSS hack是指我们为了兼容各浏览器,而使用的特别的css定义技巧.这是国外摘来的一张CSS hack列表,显示了各浏览器对css hack的支持程度,对我们制作兼容网页非常有帮助.

  4. .net core 安装Swagger

    Install-Package Swashbuckle -Pre 1.Startup // This method gets called by the runtime. Use this metho ...

  5. 彻底找到 Tomcat 启动速度慢的元凶 /dev/random

    参考  http://blog.csdn.net/u013939884/article/details/72860358

  6. 【Foreign】Game [博弈论][DP]

    Game Time Limit: 20 Sec  Memory Limit: 512 MB Description 从前有个游戏.游戏分为 k 轮. 给定一个由小写英文字母组成的字符串的集合 S, 在 ...

  7. 【POJ】1222 EXTENDED LIGHTS OUT

    [算法]高斯消元 [题解] 高斯消元经典题型:异或方程组 poj 1222 高斯消元详解 异或相当于相加后mod2 异或方程组就是把加减消元全部改为异或. 异或性质:00 11为假,01 10为真.与 ...

  8. PHP正则 贪婪匹配与非贪婪匹配

    $str = ".abcdeabcde"; preg_match('/a.+?e/', $str, $match); print_r($match); Array ( [0] =& ...

  9. HDU 1069 Monkey and Banana (dp)

    题目链接 Problem Description A group of researchers are designing an experiment to test the IQ of a monk ...

  10. web-project 故障查看功能 检测是否启动fmd服务

    def check_fmd_service(): try: output = subprocess.check_output('svcs -H -o state fmd',shell=True) st ...