Home >Database >Mysql Tutorial >SSH开发中解决mysql数据库的乱码问题_MySQL

SSH开发中解决mysql数据库的乱码问题_MySQL

WBOY
WBOYOriginal
2016-06-01 13:01:17975browse

(1)第一点要保证

\

\

就是创建数据库的时候 使用的编码方式 和连接数据库的 编码格式是一样的!

(2)在web.xml文件中配置过滤器(由spring提供的过滤器)

 

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

然后就可以就解决中文的乱码问题

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn