• 大小: 2.22MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-10
  • 语言: Java
  • 标签: java  图书  代码  

资源简介

高校在线图书商城代码 1.使用Microsoft sqlserver 2005 实现在线图书商城的数据库搭建工作; 2.通过使用java语言来实现本系统的业务功能; 3.使用dreamweaver和jsp技术实现网站的设计以及网站与功能之间的连接。

资源截图

代码片段和文件信息

//Created by MyEclipse Struts
// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.1.0/xslt/JavaClass.xsl

package com.action;

import java.util.Vector;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.sql.DataSource;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

import com.bean.Book;
import com.bean.ShopCart;
import com.util.DBBook;

/** 
 * MyEclipse Struts
 * Creation date: 12-20-2006
 * 
 * XDoclet definition:
 * @struts.action path=“/bookBuy“ name=“bookDetailForm“ input=“/failure.jsp“ scope=“request“ validate=“true“
 * @struts.action-forward name=“success“ path=“/bookShopCart.jsp“
 * @struts.action-forward name=“failure“ path=“/failure.jsp“
 */
public class BookBuyAction extends Action {

// --------------------------------------------------------- Instance Variables

// --------------------------------------------------------- Methods

/** 
 * Method execute
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return ActionForward
 * @throws Exception 
 */
public ActionForward execute(
ActionMapping mapping
ActionForm form
HttpServletRequest request
HttpServletResponse response) throws Exception {
DynaActionForm bookDetailForm = (DynaActionForm) form;
String bookId = bookDetailForm.getString(“bookId“);
HttpSession session =request.getSession();
ServletContext context = servlet.getServletContext();
DataSource ds = (DataSource)context.getAttribute(“conmysql“);
Vector shopCartList = (Vector)session.getAttribute(“SHOPCARTLIST“);
if(shopCartList==null||shopCartList.size()<1){
shopCartList = new Vector();
}
boolean bought = false;
if(shopCartList!=null){
for(int i=0;i ShopCart shopCartItem=(ShopCart)shopCartList.get(i);
if(shopCartItem.getBookID()==Integer.parseInt(bookId))
bought=true;
}
}
if(bought==false){
DBBook dbbook = new DBBook(ds);
Book book = dbbook.getBookDetail(bookId);
ShopCart shopCart = new ShopCart();

shopCart.setBookID(book.getBookID());
shopCart.setAuthor(book.getAuthor());
shopCart.setBookName(book.getBookName());
shopCart.setContent(book.getContent());
shopCart.setBookClassID(book.getBookClassID());
shopCart.setIsbn(book.getIsbn());
shopCart.setPrice(book.getPrice());
shopCart.setPublishtime(book.getPublishtime());
shopCart.setCount(1);

shopCartList.add(shopCart);
session.setAttribute(“SHOPCARTLIST“shopCartList);
}
return mapping.findForward(“success“);
}

}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-05-24 19:42  bookstore\
     文件        1207  2012-05-13 22:16  bookstore\.classpath
     目录           0  2018-10-23 23:53  bookstore\.myeclipse\
     文件         302  2012-05-13 22:16  bookstore\.mymetadata
     文件         243  2012-05-13 22:16  bookstore\.mystrutsdata
     文件        1564  2012-05-13 22:16  bookstore\.project
     目录           0  2015-05-24 19:42  bookstore\WebRoot\
     目录           0  2015-05-24 19:42  bookstore\WebRoot\meta-INF\
     文件          39  2012-05-13 22:16  bookstore\WebRoot\meta-INF\MANIFEST.MF
     目录           0  2015-05-24 19:42  bookstore\WebRoot\WEB-INF\
     文件        7738  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\.struts-config.mex
     目录           0  2015-05-24 19:42  bookstore\WebRoot\WEB-INF\classes\
     目录           0  2015-05-24 19:42  bookstore\WebRoot\WEB-INF\classes\com\
     目录           0  2015-05-24 19:42  bookstore\WebRoot\WEB-INF\classes\com\Resource\
     文件         537  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\Resource\Resource.properties
     文件         383  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\Resource\Resource_en.properties
     文件         378  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\Resource\Resource_temp.properties
     文件         537  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\Resource\Resource_zh.properties
     目录           0  2015-05-24 19:42  bookstore\WebRoot\WEB-INF\classes\com\action\
     文件        3611  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\action\BookBuyAction.class
     文件        2273  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\action\BookClassSearchAction.class
     文件        2240  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\action\BookDetailAction.class
     文件        2564  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\action\BookSearchAction.class
     文件        1468  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\action\ClearShopCartAction.class
     文件        2974  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\action\LoginAction.class
     文件        2730  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\action\RegistAction.class
     文件        2405  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\action\UpdateShopCartAction.class
     目录           0  2015-05-24 19:42  bookstore\WebRoot\WEB-INF\classes\com\bean\
     文件        1953  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\bean\Book.class
     文件         761  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\bean\BookClass.class
     文件         466  2012-05-13 22:16  bookstore\WebRoot\WEB-INF\classes\com\bean\ShopCart.class
............此处省略119个文件信息

评论

共有 条评论