📄 commentsearch.jsp
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312" import="java.sql.*"%>
<jsp:useBean id="search" class="Bean.DbConn" scope="page"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
ResultSet rs=null;
String strSql="select car.car_id,member.user_name,type,content,comment_time,comment_id from comment,car,member where comment.car_id=car.car_id and comment.user_name=member.user_name";
search.open();
rs=search.executeQuery(strSql);
out.print("<center>");
out.print("<caption align='top'><H2>用户评论信息浏览表</H2>");
out.println("<table border='1' width='700' bgcolor='#cccccc'>");
%>
<tr>
<th>用户名</th>
<th>汽车型号</th>
<th>评论内容</th>
<th>评论时间</th>
<th>操作</th>
</tr>
<%
while(rs.next())
{
ResultSet rs1=null;
int car_id=rs.getInt(1);
String user_name=rs.getString(2);
String type=rs.getString(3);
String content=rs.getString(4);
String c=rs.getString(5);
String comment_time=c.substring(0,10);
int comment_id=rs.getInt(6);
String carNameType="";
String str="select bname from category,car where category.brand_id=car.brand_id and car_id="+car_id;
rs1=search.executeQuery(str);
if(rs1.next())
carNameType=rs1.getString(1)+type;
/**out.print(car_id);
out.print("<br>");
out.print(user_name);
out.print("<br>");
out.print(content);
out.print("<br>");
out.print(comment_time);
out.print("<br>");
out.print(carNameType);*/
out.println("<tr><td>"+user_name+"</td>");
out.println("<td>"+carNameType+"</td>");
out.println("<td>"+content+"</td>");
out.println("<td>"+comment_time+"</td>");
out.println("<td><a href='commentDelete.jsp?comment_id="+comment_id+"'>【删除】</a></td></tr>");
}
out.println("</table>");
out.println("</center>");
search.close();
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -