• 大小: 19.67M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-13
  • 语言: 其他
  • 标签: 其他  

资源简介

secondHandBookstore.rar

资源截图

代码片段和文件信息

package com.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.commons.lang3.StringUtils;
import org.apache.struts2.ServletActionContext;

import com.dao.TCatelogDAO;
import com.dao.TGoodsDAO;
import com.dao.TOrderDAO;
import com.dao.TOrderItemDAO;
import com.dao.TXiaoleibieDAO;
import com.model.TCatelog;
import com.model.TGoods;
import com.model.TOrder;
import com.model.TOrderItem;
import com.model.TUser;
import com.opensymphony.xwork2.ActionSupport;
import com.service.cartService;
import com.util.Cart;

public class buyAction extends ActionSupport
{
private int goodsId;
private int quantity;

private int orderId;

private TGoodsDAO goodsDAO;
private TOrderDAO orderDAO;
private TOrderItemDAO orderItemDAO;

private String message;
private String path;

private String odderSonghuodizhi;
private String odderFukuangfangshi;
private TCatelogDAO catelogDAO;
private TXiaoleibieDAO xiaoleibieDAO;
private String orderBianhao;
//添加商品到购物车
public String addToCart()
{
TGoods goods=goodsDAO.findById(goodsId);
TOrderItem orderItem=new TOrderItem();
orderItem.setGoods(goods);
orderItem.setGoodsQuantity(quantity);

Map session= ServletActionContext.getContext().getSession();
Cart cart = (Cart)session.get(“cart“);
cart.addGoods(goodsId orderItem);
session.put(“cart“cart);
//this.setMessage(““);
this.setPath(“myCart.action“);
return “succeed“;
}



public String myCart()
{
//图书类别
        String sql=“from TCatelog where catelogDel=‘no‘“;
List cateLogList=catelogDAO.getHibernateTemplate().find(sql);
for(int i=0;i {
TCatelog catelog=(TCatelog)cateLogList.get(i);
String ss=“from TXiaoleibie where del=‘no‘ and catelogId=“+catelog.getCatelogId();
catelog.setXiaoleibieList(xiaoleibieDAO.getHibernateTemplate().find(ss));
}
Map request=(Map)ServletActionContext.getContext().get(“request“);
request.put(“cateLogList“ cateLogList);
return ActionSupport.SUCCESS;
}




//订单确认
public String orderQueren()
{
Map request=(Map)ServletActionContext.getContext().get(“request“);

return ActionSupport.SUCCESS;
}



//订单提交
public String orderSubmit()
{
Map session= ServletActionContext.getContext().getSession();
Cart cart = (Cart)session.get(“cart“);
TUser user=(TUser)session.get(“user“);
TOrder order=new TOrder();
order.setOrderBianhao(new SimpleDateFormat(“yyyyMMddhhmmss“).format(new Date()));
order.setOrderDate(new SimpleDateFormat(“yyyy-MM-dd hh:mm:ss“).format(new Date()));
order.

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

     文件        834  2018-03-16 09:48  secondHandBookstore\.classpath

     文件       1052  2018-03-16 09:48  secondHandBookstore\.project

     文件        567  2018-03-16 09:48  secondHandBookstore\.settings\.jsdtscope

     文件         79  2018-03-16 15:10  secondHandBookstore\.settings\org.eclipse.core.resources.prefs

     文件        364  2018-03-16 09:48  secondHandBookstore\.settings\org.eclipse.jdt.core.prefs

     文件        509  2018-03-16 09:48  secondHandBookstore\.settings\org.eclipse.wst.common.component

     文件        345  2018-03-16 09:48  secondHandBookstore\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2018-03-16 09:48  secondHandBookstore\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2018-03-16 09:48  secondHandBookstore\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件      10811  2018-03-18 17:35  secondHandBookstore\build\classes\com\action\buyAction.class

     文件       6025  2018-03-17 15:20  secondHandBookstore\build\classes\com\action\catelogAction.class

     文件      11259  2018-03-17 14:59  secondHandBookstore\build\classes\com\action\goodsAction.class

     文件       2847  2018-03-16 15:23  secondHandBookstore\build\classes\com\action\indexAction.class

     文件       3359  2018-03-16 15:23  secondHandBookstore\build\classes\com\action\pinglunAction.class

     文件       9545  2018-03-17 12:07  secondHandBookstore\build\classes\com\action\UserAction.class

     文件       3538  2018-03-17 15:42  secondHandBookstore\build\classes\com\action\xiaoleibieAction.class

     文件       7690  2018-03-16 15:23  secondHandBookstore\build\classes\com\dao\TAdminDAO.class

     文件       5884  2018-03-16 15:23  secondHandBookstore\build\classes\com\dao\TCatelogDAO.class

     文件       6652  2018-03-16 15:23  secondHandBookstore\build\classes\com\dao\TGoodsDAO.class

     文件       5693  2018-03-16 15:23  secondHandBookstore\build\classes\com\dao\TOrderDAO.class

     文件       5622  2018-03-16 15:23  secondHandBookstore\build\classes\com\dao\TOrderItemDAO.class

     文件       5136  2018-03-16 15:23  secondHandBookstore\build\classes\com\dao\TPinglunDAO.class

     文件       7612  2018-03-17 10:39  secondHandBookstore\build\classes\com\dao\TUserDAO.class

     文件       5208  2018-03-16 15:23  secondHandBookstore\build\classes\com\dao\TXiaoleibieDAO.class

     文件       1149  2018-03-16 15:23  secondHandBookstore\build\classes\com\model\TAdmin.class

     文件        782  2018-03-16 09:49  secondHandBookstore\build\classes\com\model\TAdmin.hbm.xml

     文件       1310  2018-03-16 15:23  secondHandBookstore\build\classes\com\model\TCatelog.class

     文件        809  2018-03-16 09:49  secondHandBookstore\build\classes\com\model\TCatelog.hbm.xml

     文件       2421  2018-03-16 15:23  secondHandBookstore\build\classes\com\model\TGoods.class

     文件       1710  2018-03-16 09:49  secondHandBookstore\build\classes\com\model\TGoods.hbm.xml

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

评论

共有 条评论