评论信息
<%
int floor = 1;
Connection comcon;
Statement comsql;
ResultSet comrs;
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
out.print("驱动异常");
}
comcon = DriverManager.getConnection("jdbc:mysql://localhost/db_bbs", "root", "");
comsql = comcon.createStatement();
String comment = null;
comment = "select commentid,comment,time,username from comment where subid = (select id from send where id ='"
+ id + "')";
comrs = comsql.executeQuery(comment);
try {
while (comrs.next()) {
%>
<%
if (!adminuser.equals("")) {
%>
"
role="button"> <%
} else {
out.print("");
}
%>
<%if(comrs.getString("comment").matches(regex)) {%>
<%
}else{
%>
<%=comrs.getString("comment")%>
<%} %>
<%=floor++%>楼 <%=comrs.getString("username")%> <%=comrs.getDate("time")%> <%=comrs.getTime("time")%>
<%
}
} catch (Exception e) {
out.print("无法显示评论信息");
}
comsql.close();
comrs.close();
comcon.close();
%>