request.getparameter()乱码问题(注:已经加入request.setCharacterEncoding("GB2312")
下面是代码<%@ page language="java" contentType="text/html; charset=GB2312"
pageEncoding="GB2312"%>
<%@page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" >
<title>Insert title here</title>
</head>
<body>
<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:db1");
request.setCharacterEncoding("GB2312"); //明明已经加入("GB2312")了
Statement smt=conn.createStatement();
String str1=request.getParameter("carid");
out.println(str1);
%>
</body>
</html> 乱码 --------------------编程问答-------------------- GB2312 都改成 GBK 就可以啦
--------------------编程问答-------------------- 你的param不会是通过URL传递的吧
补充:Java , Web 开发