把这两段加上,就ok了
<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>
<head>
<title>ss</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
如果是英文系统
要进行编码转换的
在bean里写函数,调用就可以了
//处理中文问题的自定义函数
public String getcn(String str)//取、
{
try
{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("GBK");
String temp=new String(temp_t,"ISO8859_1");
return temp;
}
catch(Exception e)
{ return "null";}
}
public String setcn(String str)//存
{
try
{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("ISO8859_1");
String temp=new String(temp_t);
return temp;
}
catch(Exception e)
{ return "null";}
}
<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>
<head>
<title>ss</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
如果是英文系统
要进行编码转换的
在bean里写函数,调用就可以了
//处理中文问题的自定义函数
public String getcn(String str)//取、
{
try
{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("GBK");
String temp=new String(temp_t,"ISO8859_1");
return temp;
}
catch(Exception e)
{ return "null";}
}
public String setcn(String str)//存
{
try
{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("ISO8859_1");
String temp=new String(temp_t);
return temp;
}
catch(Exception e)
{ return "null";}
}
要用request("content").getBytes("ISO8859-1")来转化一下就可以了