• 大小: 1.76MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-16
  • 语言: Java
  • 标签: 图书  JAVA  

资源简介

J2EE图书商城系统,MySQL数据库,绝对可用

资源截图

代码片段和文件信息


package BookStore;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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 javax.servlet.ServletContext;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;

import java.util.*;
import javax.servlet.http.*;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

public final class AddrConfirmAction extends Action{  
public ActionForward execute(
ActionMapping mapping
ActionForm form
HttpServletRequest request  
HttpServletResponse response) throws Exception {

    DynaActionForm deliveryForm = (DynaActionForm) form;         
String delivery = (String)deliveryForm.get(“deliv“);
String payment = (String)deliveryForm.get(“payment“);

    ServletContext context = servlet.getServletContext();
DataSource dataSource = (DataSource)context.getAttribute(Constants.DATASOURCE_KEY);
        DB db = new DB(dataSource);
        
        HttpSession session = request.getSession();
    Vector shopCartList=(Vector)session.getAttribute(Constants.BOOK_SHOPCART_KEY);

String PageForward;
ActionMessages errors = new ActionMessages();
if (shopCartList==null||shopCartList.size()==0){
            errors.add(ActionMessages.GLOBAL_MESSAGE
                           new ActionMessage(“errors.nullShopCart“));
if (!errors.isEmpty()) {
saveErrors(request errors);

  PageForward=“toWrong“;  

}
else{
Order order = new Order();
order.setUsername ((String)session.getAttribute(Constants.LOGIN_USERNAME_KEY));
order.setDelivery(delivery);
order.setPayment(payment);
ShopCart shopCart = new ShopCart();

int orderId=order.Insert(db);
if (orderId==-1){
             errors.add(ActionMessages.GLOBAL_MESSAGE
                           new ActionMessage(“errors.insertFail“));
if (!errors.isEmpty()) {
saveErrors(request errors);

  PageForward=“toWrong“;  
}
else{
        order.setId(orderId);
session.setAttribute(Constants.BOOK_ORDER_KEYorder);
        if(shopCartList!=null){
        for(int i = 0; i < shopCartList.size() ;i++){
        shopCart = (ShopCart)shopCartList.get(i);
        shopCart.Save(dborderId);
        }
}
order.setTotal(order.GetOrderTotal(db));
Vector orderDetail=(Vector)shopCartList.clone();
session.setAttribute(Constants.ORDER_DETAIL_KEYorderDetail);
shopCartList.clear();
  PageForward=“toOrderConfirm“;  
}
    }
db.close();
    return (mapping.findForward(PageForward));
  }
 
}

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

     文件       4307  2005-07-05 14:33  bookstore\bookMain.jsp

     文件       6592  2005-07-05 14:33  bookstore\bookShopCart.jsp

     文件       3428  2005-07-05 14:33  bookstore\bookShow.jsp

     文件       1949  2005-07-05 14:33  bookstore\bookstore.sql

     文件       2177  2005-07-05 14:33  bookstore\images\00-1.gif

     文件       2144  2005-07-05 14:33  bookstore\images\00-2.gif

     文件       4537  2005-07-05 14:33  bookstore\images\007.gif

     文件       1916  2005-07-05 14:33  bookstore\images\b10025.gif

     文件      19789  2005-07-05 14:33  bookstore\images\banner.gif

     文件         84  2005-07-05 14:33  bookstore\images\book.gif

     文件       3787  2005-07-05 14:33  bookstore\images\book00001.jpg

     文件      13519  2005-07-05 14:33  bookstore\images\book00002.jpg

     文件       2253  2005-07-05 14:33  bookstore\images\book800_005.gif

     文件        192  2005-07-05 14:33  bookstore\images\book800_081.gif

     文件        985  2005-07-05 14:33  bookstore\images\book800_19_08.gif

     文件      10617  2005-07-05 14:33  bookstore\images\bookTop.gif

     文件       4010  2005-07-05 14:33  bookstore\images\book_001.gif

     文件       1779  2005-07-05 14:33  bookstore\images\book_002.gif

     文件       2204  2005-07-05 14:33  bookstore\images\book_003.gif

     文件         73  2005-07-05 14:33  bookstore\images\book_004.gif

     文件        721  2005-07-05 14:33  bookstore\images\book_005.gif

     文件        766  2005-07-05 14:33  bookstore\images\book_006.gif

     文件        726  2005-07-05 14:33  bookstore\images\book_007.gif

     文件        730  2005-07-05 14:33  bookstore\images\book_008.gif

     文件       1958  2005-07-05 14:33  bookstore\images\book_011.gif

     文件        689  2005-07-05 14:33  bookstore\images\book_012.gif

     文件        705  2005-07-05 14:33  bookstore\images\book_013.gif

     文件       2368  2005-07-05 14:33  bookstore\images\book_020.gif

     文件        565  2005-07-05 14:33  bookstore\images\book_026.gif

     文件       1628  2005-07-05 14:33  bookstore\images\book_027.gif

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

评论

共有 条评论