我的页面总不行.真不知道错在哪里了
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*"%>
<%!
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
public void jspInit()
{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:ClassDB");
stmt=con.createStatement(
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
}
public void jspDestroy()
{
try{
rs.close();
stmt.close();
con.close();
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
}
public String ShowContent(String strCon)
{
int SPos=0;
int EPos=0;
int totallen=strCon.length();
String strShow="";
char cr=13, If=10;
String strMid=null;
for(EPos=0;EPos<totallen;EPos++);
{
char c=strCon.charAt(EPos);
if(c==13)
{
if(EPos !=SPos)
{
strMid=strCon.substring(SPos,EPos);
strShow=strShow + ">" + strMid + cr + If;
}
else
strShow=strShow + ">" + cr + If;
SPos=EPos +2;
}
}
if(SPos < totallen)
{
strMid=strCon.substring(SPos,EPos);
strShow=strShow + ">" + strMid + cr + If;
}
return strShow;
}
%>
<html>
<head>
<title>讨论区</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<%
String RepID=request.getParameter("RepID");
String Title=request.getParameter("Title");
String PostID=request.getParameter("PostID");
%>
<script language="JavaScript">
<!--
function Abort(RID)
{
self.location="Content.jsp?ID=" + RID;
}
-->
</script>
</head>
<body>
<form action="<%="post.jsp?RepID=" + RepID%>"
method=post name=frmPost>
<P>发言人:
<INPUT name="Poster" style="height:25px;width:151px"></p>
<p>e-mail:<input name="e-mail" style="height:25px;width:383px"></p>
<p>标题:<input name="Title" style="height:25px;width:401px"></p>
<%
if(!RepID.equals("0"))
{
Title="Re:" + Title;
out.println("value=\"" + Title + "\"");
}
%></p>
内容:<br>
<textarea name="Content" style="height:155px;width:601px">
<%
String strSQL=null;
if(!RepID.equals("0"))
{
strSQL="SELECT Content FROM Board WHERE ID = " +PostID;
rs=stmt.executeQuery(strSQL);
rs.next();
out.println(ShowContent(rs.getString("Content")));
}
else
{
strSQL="SELECT ID FROM Board " + " WHERE RepID=0 ORDER BY LastRep DESC";
rs=stmt.executeQuery(strSQL);
rs.next();
RepID=rs.getString("ID");
}
%>
</textarea>
<p><input name="submit1" type="submit" value="张贴">
<input name="reset1" type="reset" value="我要重新写">
<input type="button" value="放弃" name="botton1"
onclick="Abort(<%=RepID%>)">
</p>
</form>
</body>
</html>
其中我的ACCESS数据库中有表Board,表中有字段ID/Poster/PostTime/Content/RepID/LastRep/RepNum/ConNum这几个字段