91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 720KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-07
  • 語言: Java
  • 標簽:

資源簡介

是自己暑假編的,可以簡單的利用數據庫實現對用戶的注冊及留言板的提交。

資源截圖

代碼片段和文件信息

package?com.control;

import?java.io.*;
import?java.sql.*;
import?javax.servlet.*;
import?javax.servlet.http.*;
import?com.model.BookBean;

public?class?BookQueryServlet?extends?HttpServlet?{
Connection?dbConnection;

public?void?init()?{
String?driver?=?“org.postgresql.Driver“;
String?dburl?=?“jdbc:postgresql://127.0.0.1:5432/bookstore“;
String?username?=?“bookstore“;
String?password?=?“bookstore“;
try?{
Class.forName(driver);?//?加載數據庫驅動程序
//?創建數據庫連接對象
dbConnection?=?DriverManager.getConnection(dburl?username
password);
}?catch?(ClassNotFoundException?e1)?{
}?catch?(SQLException?e2)?{
}
}

public?void?doPost(HttpServletRequest?request?HttpServletResponse?response)
throws?ServletException?IOException?{
String?bookid?=?request.getParameter(“bookid“);
try?{
String?sql?=?“SELECT?*?FROM?books?WHERE?bookid=?“;
PreparedStatement?pstmt?=?dbConnection.prepareStatement(sql);
pstmt.setString(1?bookid);
ResultSet?rst?=?pstmt.executeQuery();
if?(rst.next())?{
BookBean?book?=?new?BookBean();
book.setBookid(rst.getString(“bookid“));
book.settitle(rst.getString(“title“));
book.setAuthor(rst.getString(“author“));
book.setPrice(rst.getDouble(“price“));
book.setPublisher(rst.getString(“publisher“));
request.getSession().setAttribute(“book“?book);
RequestDispatcher?view?=?request
.getRequestDispatcher(“/showBook.jsp“);
view.forward(request?response);
}?else?{
RequestDispatcher?view?=?request
.getRequestDispatcher(“/error.jsp“);
view.forward(request?response);
}
}?catch?(SQLException?e)?{
e.printStackTrace();
}
}

public?void?destroy()?{
try?{
dbConnection.close();
}?catch?(Exception?e)?{
e.printStackTrace();
}
}
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????450??2012-11-20?13:03??helloapp\.classpath

?????文件????????297??2012-11-19?14:20??helloapp\.mymetadata

?????文件???????1226??2012-11-19?14:37??helloapp\.project

?????文件???????1870??2012-11-19?14:35??helloapp\src\com\control\BookQueryServlet.java

?????文件???????1104??2012-11-19?14:30??helloapp\src\com\model\BookBean.java

?????文件????????254??2012-11-19?14:22??helloapp\WebRoot\bookQuery.jsp

?????文件????????158??2012-11-19?14:37??helloapp\WebRoot\error.jsp

?????文件????????831??2012-11-19?14:20??helloapp\WebRoot\index.jsp

?????文件?????????39??2012-11-19?14:20??helloapp\WebRoot\meta-INF\MANIFEST.MF

?????文件????????786??2012-11-19?14:36??helloapp\WebRoot\showBook.jsp

?????文件???????3274??2012-11-20?13:03??helloapp\WebRoot\WEB-INF\classes\com\control\BookQueryServlet.class

?????文件???????1655??2012-11-20?13:03??helloapp\WebRoot\WEB-INF\classes\com\model\BookBean.class

?????文件?????524911??2012-11-19?14:47??helloapp\WebRoot\WEB-INF\lib\postgresql-9.2-1002.jdbc3.jar

?????文件????????666??2012-11-19?14:33??helloapp\WebRoot\WEB-INF\web.xml

????.......???????432??2008-11-20?08:01??ly\.classpath

????.......???????280??2008-11-20?08:01??ly\.mymetadata

????.......??????1220??2008-11-20?08:01??ly\.project

????.......??????2767??2008-11-20?08:01??ly\src\db\DB.java

????.......???????735??2008-11-20?08:01??ly\src\model\LyTable.java

????.......???????474??2008-11-20?08:01??ly\src\model\User.java

????.......??????1346??2008-11-20?08:01??ly\src\servlet\AddServlet.java

????.......??????1912??2008-11-20?08:01??ly\src\servlet\MainServlet.java

????.......???????870??2008-11-20?08:01??ly\src\servlet\RegisterServlet.java

????.......???????834??2008-11-20?08:01??ly\WebRoot\index.jsp

????.......???????595??2008-11-20?08:01??ly\WebRoot\liuyan.jsp

????.......???????594??2008-11-20?08:01??ly\WebRoot\login.jsp

????.......???????906??2008-11-20?08:01??ly\WebRoot\main.jsp

????.......????????39??2008-11-20?08:01??ly\WebRoot\meta-INF\MANIFEST.MF

????.......???????523??2008-11-20?08:01??ly\WebRoot\register.jsp

????.......???????222??2008-11-20?08:01??ly\WebRoot\success.jsp

............此處省略39個文件信息

評論

共有 條評論

相關資源