我的环境是:Windows2000Server+MyEclipse4.0+Eclipse3.1+SqlServer2000+Hibernate3.0+Struts1.2,我在网上找了些文章,按他们的配置,可是都不起作用.我是这样配置的:
1.在Hibernate.cfg.xml配置文件中,加了下面的语句:
<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">UTF</property>2.在jsp页面中,添加如下语句:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<META http-equiv="contentType" content="text/html; charset=UTF-8">3.过滤器:
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("UTF-8");
chain.doFilter(request, response);
}可还是出问题,添加的时候保存到SQLSERVER2000中的中文成了乱码,这是什么原因啊?
1.在Hibernate.cfg.xml配置文件中,加了下面的语句:
<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">UTF</property>2.在jsp页面中,添加如下语句:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<META http-equiv="contentType" content="text/html; charset=UTF-8">3.过滤器:
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("UTF-8");
chain.doFilter(request, response);
}可还是出问题,添加的时候保存到SQLSERVER2000中的中文成了乱码,这是什么原因啊?
hibernate.query.factory_class=org.hibernate.hql.classic.ClassicQueryTranslatorFactory
请问
hibernate.query.factory_class=org.hibernate.hql.classic.ClassicQueryTranslatorFactory
在哪儿设置啊?
如果是tomcat在server.xml的<Host>标签中加入
<Host ...... URIEncoding="UTF-8">
以前用jdbc的时候没有问题的.
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("GB2312");
chain.doFilter(request, response);
}
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
</body>
</html>