<%!String str=new String();%>
<form name="f1" method=post action="jsp2.jsp">
<input type=text name="usename">
<input type=submit>
<input type=reset>
</form>
<%
request.setChar……("UFT-8")
str=request.getParamValue(""usename");
out.println(str);
%>
代码没有问题,并且我的代码在朋友的机子上也能运行,是不是JBUILDER 8自身的问题呀。
<form name="f1" method=post action="jsp2.jsp">
<input type=text name="usename">
<input type=submit>
<input type=reset>
</form>
<%
request.setChar……("UFT-8")
str=request.getParamValue(""usename");
out.println(str);
%>
代码没有问题,并且我的代码在朋友的机子上也能运行,是不是JBUILDER 8自身的问题呀。
String text=new String(request.getParameter("text").getBytes("ISO8859_1"));
也可以定义一个方法:
public String getStr(String str)
{
try
{
String temp1=str;
String temp=temp1.getBytes("ISO8859_1");
return temp;
}catch(Exception e)
{}
return "null";
}
然后用这个方法转换就可以了
1. <%@ page contentType="text/html; charset=UTF-8"%>
2. <%
response.setContentType("text/html; charset=UTF-8");
/**
* 以下是其它代码.....
*/
%>
3.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--html部分-->
</head>
</html>
4.把你的网页文件保存成和你的字符集一编码的格式。如上面的utf-8
5.数据库中的字符类型的(如char, varchar, text)编码也要是一致的编码。
6.就这样, 你试一下
[email protected]