|
| Chartoon |
"For all sad words of tongue and pen,
|
|
Comments on this Article <%@ page import='java.io.*, java.util.*, java.sql.*' %> <%@ include file='basiccomments.jsp' %> <%! void printOut (JspWriter out, ResultSet rs) throws Exception { out.println ("\n");
String url = rs.getString(5);
out.println ("" + rs.getString (1) + " "); // Name
out.println ("[" + rs.getString (2) + ". "); // Location
out.println (java.text.DateFormat.getDateTimeInstance().format (rs.getTimestamp(3)) + "]");
if ((url!= null) && (url.length()>11)&& (url.substring(0,7).equals ("http://")) ) {
out.println (" ");
out.println ("Website");
out.println ("");
}
out.println (" "); Connection conn = DriverManager.getConnection(url, user, password); //out.println ("After conn... "); PreparedStatement stmt = conn.prepareStatement("SELECT Name, Location, CommentTime, Comments, URL FROM Comments WHERE CommentId=? and CommentType=? order by CommentTime desc"); stmt.setInt (1, Integer.parseInt (request.getParameter ("cid"))); stmt.setString (2, request.getParameter ("cmtType")); ResultSet rs = stmt.executeQuery(); if (rs.next()) { printOut(out, rs); while (rs.next()) printOut (out, rs); } else out.println (" Be the first to comment on this item. "); } catch (Exception e) { out.println (e); } %> |
| news |