JSP中连接数据库的问题
<%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.* "
errorPage= " " %>
<%@ page import= "java.sql.* " %>
<%@ page import= "java.util.Date " %>
<%@ page import= "java.io.* " %>
<%!
String trans(String chi)
{
String result = null;
byte temp [];
try
{
temp=chi.getBytes( "iso-8859-1 ");
result = new String(temp);
}
catch(
java.io.UnsupportedEncodingException e)
{
System.out.println (e.toString());
}
return result;
}
String trans(Object chi)
{
return trans(chi.toString());
}
%>
<jsp:useBean id= "db " scope= "page " class= "demo.openDB " />
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> 查看留言 </title>
<style type= "text/css ">
<!--
.STYLE1 {color: #FFFFFF}
body {
background-image: url(简单论坛/n3olcx.jpg);
}
.STYLE2 {
color: #F9F9F9;
font-size: 24px;
font-family: "华文隶书 ";
}
-->
</style>
</head>
<body>
<%
String id=request.getParameter( "id ");
String name=trans(request.getParameter( "name "));
String price=request.getParameter( "price ");
String producer=trans(request.getParameter( "producer "));
String descript=trans(request.getParameter( "