1. The JSP
<% @ page language="Java" import="Java. Util. *" contentType="text/HTML. Charset=gb2312 "% & gt;
<% @ page import="Java. SQL. *" % & gt;
<% request. The setCharacterEncoding (" GBK ");
The response. SetCharacterEncoding (" GBK ");
//String userid=request. The getParameter (" userid ");
String userid=new String (request. The getParameter (" userid "). GetBytes (" ISO8859_1 "), "utf-8");
System. The out. Print (userid);
Connection conn=null;
The Statement stat=null;
ResultSet rs=null;
Class.forName("com.mysql.jdbc.Driver");
The String url="JDBC: mysql://localhost: 3306/zhbit";
String user="root";
String password="ax191823503";
Conn=DriverManager. GetConnection (url, user, password);
The stat=conn. CreateStatement ();
Rs=stat. ExecuteQuery (" select * from the user where userid='" + userid + "' ");
%>
<%
While (rs), next ())
{
Out. Print (" & lt; Tr>" );
Out. Print (" & lt; Td>" + rs. Get string (" userid ") + "& lt;/td>" );
Out. Print (" & lt; Td>" + rs. Get string (" name ") + "& lt;/td>" );
Out. Print (" & lt; Td>" + rs. Get string (" password ") + "& lt;/td>" );
Out. Print (" & lt;/tr>" );
%>
& lt; H3 & gt;
return information query page
<%
}
%>
<%
If (rs!=null)
{
Rs. The close ();
Rs=null;
}
If (stat!=null)
{
Stat. The close ();
The stat=null;
}
If (conn!=null)
{
conn.close();
Conn=null;
}
%>