• 大小: 5.56MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-18
  • 语言: Java
  • 标签: javaweb  

资源简介

一个javaWeb项目,网上书店。主要是三层架构的使用。能够实现基本功能。

资源截图

代码片段和文件信息

package controler;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.BOOKS;
import model.BOOKSDAO;

public class AddBooks extends HttpServlet {

/**
 * Constructor of the object.
 */
public AddBooks() {
super();
}

/**
 * Destruction of the servlet. 

 */
public void destroy() {
super.destroy(); // Just puts “destroy“ string in log
// Put your code here
}

/**
 * The doGet method of the servlet. 

 *
 * This method is called when a form has its tag value method equals to get.
 * 
 * @param request the request send by the client to the server
 * @param response the response send by the server to the client
 * @throws ServletException if an error occurred
 * @throws IOException if an error occurred
 */
public void doGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {

response.setContentType(“text/html“);
PrintWriter out = response.getWriter();
out
.println(““);
out.println(““);
out.println(“  tle>A Servlettle>“);
out.println(“  “);
out.print(“    This is “);
out.print(this.getClass());
out.println(“ using the GET method“);
out.println(“  “);
out.println(““);
out.flush();
out.close();
}

/**
 * The doPost method of the servlet. 

 *
 * This method is called when a form has its tag value method equals to post.
 * 
 * @param request the request send by the client to the server
 * @param response the response send by the server to the client
 * @throws ServletException if an error occurred
 * @throws IOException if an error occurred
 */
public void doPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {

response.setContentType(“text/html;charset=GBK“);
request.setCharacterEncoding(“GBK“);
BOOKS b = new BOOKS();
b.setBookName(request.getParameter(“bookname“));
b.setBookPrice( Float.parseFloat(request.getParameter(“price“)));
b.setPublisherId(request.getParameter(“select1“));
b.setBookAuthor(request.getParameter(“author“));
b.setBookIsdn(request.getParameter(“isbn“));
b.setDiscount(Integer.parseInt(request.getParameter(“dicount“)));
b.setBookEdition(request.getParameter(“edition“));
b.setBookWords(request.getParameter(“words“));
b.setBookPages(request.getParameter(“pages“));
b.setBookFolio(request.getParameter(“folio“));
b.setBookPicture(request.getParameter(“img“));
System.out.println(request.getParameter(“img“));
b.setBookIntroduction(request.getParameter(“bookintroduce“));
BOOKSDAO bd = new BOOKSDAO();
int i = bd.addBooks(b);
System.out.println(i)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        605  2009-09-24 08:31  TaoShuBao\XIANGMU\.classpath

     文件        294  2009-09-24 15:57  TaoShuBao\XIANGMU\.mymetadata

     文件       1225  2009-09-08 17:00  TaoShuBao\XIANGMU\.project

     文件       3273  2009-09-23 10:59  TaoShuBao\XIANGMU\src\controler\AddBooks.java

     文件       1966  2009-09-19 14:19  TaoShuBao\XIANGMU\src\controler\AdminLogon.java

     文件       2032  2009-09-15 16:55  TaoShuBao\XIANGMU\src\controler\AdminPassword.java

     文件       2294  2009-09-16 15:10  TaoShuBao\XIANGMU\src\controler\BookSearch.java

     文件       3273  2009-09-21 16:27  TaoShuBao\XIANGMU\src\controler\UserModify.java

     文件       3236  2009-09-22 19:28  TaoShuBao\XIANGMU\src\controler\UserReg.java

     文件       3308  2009-09-19 14:04  TaoShuBao\XIANGMU\src\imgcheck\RandImgCreater.java

     文件        586  2009-09-07 10:24  TaoShuBao\XIANGMU\src\model\BookKind.java

     文件       1355  2009-09-25 08:58  TaoShuBao\XIANGMU\src\model\BookKindDao.java

     文件       3852  2009-09-11 10:32  TaoShuBao\XIANGMU\src\model\BOOKS.java

     文件       9970  2009-09-25 08:56  TaoShuBao\XIANGMU\src\model\BOOKSDAO.java

     文件        798  2009-09-15 10:48  TaoShuBao\XIANGMU\src\model\Cart.java

     文件        810  2009-09-07 10:25  TaoShuBao\XIANGMU\src\model\ConnectionFactory.java

     文件       1712  2009-09-07 10:25  TaoShuBao\XIANGMU\src\model\CONSIGNMENT.java

     文件       2035  2009-09-07 10:25  TaoShuBao\XIANGMU\src\model\CONSIGNMENTDAO.java

     文件       1653  2009-09-07 10:25  TaoShuBao\XIANGMU\src\model\DETAIL_OFPROPERTIES.java

     文件       1903  2009-09-07 10:36  TaoShuBao\XIANGMU\src\model\DETAIL_OFPROPERTIESDAO.java

     文件       1245  2009-09-17 21:22  TaoShuBao\XIANGMU\src\model\DINGDAN.java

     文件       2456  2009-09-25 08:57  TaoShuBao\XIANGMU\src\model\DingDanDAO.java

     文件        881  2009-09-07 10:26  TaoShuBao\XIANGMU\src\model\ExpressDetail.java

     文件       1422  2009-09-07 10:27  TaoShuBao\XIANGMU\src\model\ExpressDetailDao.java

     文件        341  2009-09-07 10:43  TaoShuBao\XIANGMU\src\model\Grade.java

     文件       1535  2009-09-07 10:43  TaoShuBao\XIANGMU\src\model\GradeDAO.java

     文件        541  2009-09-08 10:24  TaoShuBao\XIANGMU\src\model\Guanliyuan.java

     文件       3681  2009-09-14 16:53  TaoShuBao\XIANGMU\src\model\GuanliyuanDAO.java

     文件        963  2009-09-15 10:51  TaoShuBao\XIANGMU\src\model\Item.java

     文件       1837  2009-09-07 10:27  TaoShuBao\XIANGMU\src\model\MANUFACTURER.java

............此处省略478个文件信息

评论

共有 条评论