七.backcall(回复页面)
<%@ page contentType="text/html; charset=GB2312" %>
<%@ page import = "java.sql.*" %>
<%
response.setContentType("text/html; charset=GB2312");
request.setCharacterEncoding("GB2312");
int id = Integer.parseInt(request.getParameter("id"));//获取传过来的ID
String title, userName, email, textmain, lasttime, sql;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection cn = DriverManager.getConnection("jdbc:odbc:BBSDSN");
Statement st = cn.createStatement();
sql = "select * from BBS_TEXT where ID=" + id;
ResultSet rs = st.executeQuery(sql);
rs.next();
title = rs.getString("TITLE");
userName = rs.getString("USERNAME");
email = rs.getString("EMAIL");
textmain = rs.getString("TEXTMAIN");
lasttime = rs.getString("LASTTIME");
out.print("<html>");
out.print("<head>");
out.print("<script language=JavaScript>");
out.print("function checkform(formbackCall)");
out.print("{");
out.print("var flag = true;");
out.print("if(formbackCall.txtbackCall.value == \"\" || formbackCall.txtbackCall.value == null)");
out.print("{");
out.print("alert(\"回复内容不能为空!\");");
out.print("formbackCall.txtbackCall.focus();");
out.print("flag = false;");
out.print("}");
out.print("return flag;");
out.print("}");
out.print("</script>");
out.print("<title>阿当论坛--回复帖子</title>");
out.print("</head>");
out.print("<body bgcolor=#CCFFFF>");
out.print("<center>");
out.print("<table border=0 width=80% bordercolor=#000000 bordercolordark=#FFFFFF>");
out.print("<tr>");
out.print("<td align=left>");
out.print("<font face=宋体 size=1><b>主题:</b> " + title);
out.print("</font>");
out.print("</td>");
out.print("</tr>");
out.print("<tr>");
out.print("<td align=left>");
out.print("<font face=宋体 size=1><b>作者:</b> " + userName + "</font>");
out.print("</td>");
out.print("</tr>");
out.print("<tr>");
out.print("<td align=left>");
out.print("<font face=宋体 size=1><b>作者信箱:</b> " + email + "</font>");
out.print("</td>");
out.print("</tr>");
out.print("<tr>");
out.print("<td align=left>");
out.print("<font face=宋体 size=1><b>发贴时间:</b> " + lasttime + "</font>");
out.print("</td>");
out.print("</tr>");
out.print("<tr>");
out.print("<td>");
out.print("<font face=宋体 size=1><b>正文内容:</b><br>" + textmain + "</font>");
out.print("</td>");
out.print("</tr>");
out.print("<tr><td><hr></td></tr>");
sql = "select USERNAME,EMAIL,TEXTMAIN,LASTTIME from BBS_TEXT where ROOTID=" + id;
rs = st.executeQuery(sql);
int count = 1;
while(rs.next())
{
userName = rs.getString("USERNAME");
email = rs.getString("EMAIL");
textmain = rs.getString("TEXTMAIN");
lasttime = rs.getString("LASTTIME");
out.print("<tr>");
out.print("<td>");
out.print("<font face=宋体 size=1><b>回复者:</b> " + userName + "</font>");
out.print("</td>");
out.print("</tr>");
out.print("<tr>");
out.print("<td>");
out.print("<font face=宋体 size=1><b>回复者邮箱:</b> " + email + "</font>");
out.print("</td>");
out.print("</tr>");
out.print("<tr>");
out.print("<td>");
out.print("<font face=宋体 size=1><b>回复时间:</b> " + lasttime + "</font>");
out.print("</td>");
out.print("</tr>");
out.print("<tr>");
out.print("<td>");
out.print("<font face=宋体 size=1><b>回复内容:<p/></b>" + textmain + "</font>");
out.print("</td>");
out.print("</tr>");
out.print("<tr>");
out.print("<td align=right>");
out.print("<font face=宋体 size=1>第<font face=宋体 size=2 color=red>" + count + "</font>楼</font>");
out.print("</td>");
out.print("</tr>");
count++;
out.print("<tr><td><hr></td></tr>");
}
out.print("</table>");
out.print("</center>");
out.print("<form method='POST' action='checkbackCall.jsp' name='formbackCall' onsubmit=\"return checkform(this)\">");
out.print("<center>");
out.print("<table border=0 width=80% bordercolor=#000000 bordercolordark=#FFFFFF>");
out.print("<tr>");
out.print("<td align=center>");
out.print("<font face=宋体 size=1><b>回复:</b></font><br>");
out.print("<TEXTAREA NAME=txtbackCall ROWS=5 COLS=70></TEXTAREA>");
out.print("<INPUT TYPE=hidden name=id value=" + id + ">"); //用隐藏域将ID传到检测页面
out.print("</td>");
out.print("</tr>");
out.print("<tr>");
out.print("<td align=center>");
out.print("<INPUT TYPE=submit value='回复'> <INPUT TYPE=reset value='重写'>");
out.print("</td>");
out.print("</tr>");
out.print("<tr><td align=center><font face=宋体 size=1><a href=bbsmain.jsp><br>返回到论坛主页</a></font></td></tr>");
out.print("</table>");
out.print("</center>");
out.print("</form>");
out.print("</body>");
out.print("</html>");
rs.close();
st.close();
cn.close();
}
catch(Exception e)
{
e.printStackTrace();
}
%>