jsp小问题
<%@ page language="java" %>
<%@ page import="java.sql.*,java.io.*" %>
<%
String strCount = "0";
String strFlag = request.getParameter("strFlag");
if (strFlag !=null && strFlag.equals("true")){
String strChapter = request.getParameter("chapter");
String strSection = request.getParameter("section");
String strContent = request.getParameter("content");
StringBuffer timebuffer = new StringBuffer();
String timestring =
(new java.sql.Timestamp((new java.util.Date()).getTime())).toString();
timebuffer.append(timestring.substring(0, 4));
timebuffer.append(timestring.substring(5, 7));
timebuffer.append(timestring.substring(8, 10));
timebuffer.append(timestring.substring(11, 13));
timebuffer.append(timestring.substring(14, 16));
timebuffer.append(timestring.substring(17, 19));
java.util.Date date = new java.util.Date();
String strPath = "c:\\"+ timebuffer.toString() + ".txt";
OutputStream bos = new FileOutputStream(strPath);
bos.write(strContent.getBytes());
bos.close();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String strUrl = "";
Connection con=DriverManager.getConnection("jdbc:odbc:BASE","dalily","dalily");
Statement stmt = con.createStatement();
String strSql = " insert into table (chapter,section,url) values('"
+ strChapter + "','" + strSection + "','" + strPath + "')" ;
stmt.executeUpdate(strSql);
ResultSet rsCount = stmt.executeQuery("select count(*) from table");
rsCount.next();
strCount = rsCount.getString(1);
if (rsCount !=null) rsCount.close();
if (stmt!=null) stmt.close();
if (con !=null) con.close();
}
%>