📄 interestedtopic.jsp
字号:
<%-- Document : intestedtopic Created on : 2008-7-18, 0:21:42 Author : tiredsuddenly--%><%@page import = "java.sql.*"%><%@page import = "myTools.*"%><%@page import ="ArticleSharing.*"%><%@page contentType="text/html" pageEncoding="GB2312"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>你要的话题</title> </head> <body> <% out.print("<div align=\"center\">"); out.print("<table width=\"800\" border=\"0\" bgcolor=\"ddddfd\">"); out.print("<tr>"); out.print("<td height=\"37\" bgcolor=\"ddddfd\" class=\"STYLE3\"><div align=\"left\"><strong>搜索结果:</strong></div></td>"); out.print("</tr>"); out.print("</table>"); //String topic = request.getParameter("interestedtopic"); String topic = DBTools.changeCharset(request.getParameter("interestedtopic"), "ISO-8859-1", "GB2312"); System.out.println("here is the topic!!"); System.out.println(topic); ResultSet rs = null; try { Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/dating_platform", "root", "1234"); Statement stat = conn.createStatement(); rs = stat.executeQuery("select post_id, post_title, poster_name, post_date from posts where post_title like \"%" + topic + "%\""); } catch(Exception e) { e.printStackTrace(); } System.out.println(rs); rs.last(); if(rs.getRow() == 0) { out.print("<table width=\"800\" border=\"0\">"); out.print("<tr>"); out.print("<td height=\"30\" bgcolor=\"ddddfd\" class=\"STYLE3\"><font face\"宋体\"><div align=\"center\">SORRY!没有找到你想找的话题!</div></font></td>"); out.print("</tr>"); out.print("<tr>"); out.print("<td height=\"30\" bgcolor=\"ddddfd\" class=\"STYLE3\"><div align=\"center\"><a href=\"articlelist.jsp\">返回</a></div></td>"); out.print("</tr>"); out.print("</table>"); } else { out.print("<table width=\"800\" border=\"0\" bgcolor=\"f0f0f0\"><font face=\"宋体\">" + "<tr>" + "<td width=\"151\"><div align=\"left\">编号</div></td>" + "<td width=\"513\"><div align=\"left\">帖名</div></td>" + "<td width=\"122\"><div align=\"left\">发起者</div></td>" + "<td width=\"200\"><div align=\"left\">发帖日期</div></td>" + "</tr>"); rs.beforeFirst(); int count = 1; while(rs.next()) { out.print("<tr>" + "<td><div align=\"left\">" + count + "</div></td>" + "<td><div align=\"left\"><a href=detiles.jsp?id="+ rs.getInt("post_id") + "style=\"text-decoration:none\">" + rs.getString("post_title") + "</a></div></td>" + "<td><div align=\"left\">" + rs.getString("poster_name") + "</div></td>" + "<td><div align=\"left\">" + rs.getString("post_date") + "</div></td>" + "</tr>"); count++; } out.print("</font></table>"); } %> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -