package ylsy.sjx.xj06.njb.web.action;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.MappingDispatchAction;
import ylsy.sjx.xj06.njb.domain.Food;
import ylsy.sjx.xj06.njb.domain.Order;
import ylsy.sjx.xj06.njb.services.FoodService;
import ylsy.sjx.xj06.njb.services.OrderService;
public class BuyListAction extends MappingDispatchAction {
private FoodService foodService;
public FoodService getFoodService() {
return foodService;
}
public void setFoodService(FoodService foodService) {
this.foodService = foodService;
}
private OrderService orderService;
public OrderService getOrderService() {
return orderService;
}
public void setOrderService(OrderService orderService) {
this.orderService = orderService;
}
public ActionForward buy(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String[] names = request.getParameterValues("name");
if (names == null || names.equals("")) {
String str = "你还没有点菜,请先点菜!";
request.setAttribute("str", str);
List food = foodService.findAllFood();
request.setAttribute("foodList", food);
return mapping.findForward("error");
}
List buyList = new ArrayList();
double prices = 0;
for (int i = 0; i < names.length; i++) {
Food f = foodService.findByName(names[i]);
buyList.add(f);
prices = prices + f.getPrice();
}
HttpSession session = request.getSession(true);
session.setAttribute("buyList", buyList);
session.setAttribute("prices", prices);
return mapping.findForward("success");
}
public ActionForward buynow(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String[] names = request.getParameterValues("name");
if (names == null || names.equals("")) {
String str = "你还没有点菜,请先点菜!";
request.setAttribute("str", str);
List food = foodService.findAllFood();
request.setAttribute("foodList", food);
return mapping.findForward("error");
}
List buyList = new ArrayList();
double prices = 0;
for (int i = 0; i < names.length; i++) {
Food f = foodService.findByName(names[i]);
buyList.add(f);
prices = prices + f.getPrice();
}
HttpSession session = request.getSession();
session.setAttribute("buyList", buyList);
session.setAttribute("prices", prices);
return mapping.findForward("success");
}
public ActionForward end(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
return mapping.findForward("success");
}
public ActionForward showOrderOne(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
return mapping.findForward("success");
}
public ActionForward orderOne(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String receiveName = request.getParameter("receiveName");
String fullAddress = request.getParameter("fullAddress");
String postalCode = request.getParameter("postalCode");
String mobile = request.getParameter("mobile");
String phone = request.getParameter("phone");
Date date = new Date();
HttpSession session = request.getSession();
session.setAttribute("receiveName", receiveName);
session.setAttribute("fullAddress", fullAddress);
session.setAttribute("postalCode", postalCode);
session.setAttribute("mobile", mobile);
session.setAttribute("phone", phone);
session.setAttribute("trueOrderTime", date.toString());
return mapping.findForward("success");
}
public ActionForward orderTwo(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
HttpSession session = request.getSession();
Order order = new Order();
order.setReceiveName((String)session.getAttribute("receiveName"));
order.setFullAddress((String)session.getAttribute("fullAddress"));
order.setPostalCode((String)session.getAttribute("postalCode"));
order.setMobile((String)session.getAttribute("mobile"));
order.setPhone((String)session.getAttribute("phone"));
order.setOrderTime((String)session.getAttribute("trueOrderTime"));
order.setOrderPrice((Double)session.getAttribute("prices"));
orderService.addOrder(order);
return mapping.findForward("success");
}
//管理员 开始
public ActionForward buynow_admin(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String[] names = request.getParameterValues("name");
if (names == null || names.equals("")) {
String str = "你还没有点菜,请先点菜!";
request.setAttribute("str", str);
List food = foodService.findAllFood();
request.setAttribute("foodList", food);
return mapping.findForward("error");
}
List buyList = new ArrayList();
double prices = 0;
for (int i = 0; i < names.length; i++) {
Food f = foodService.findByName(names[i]);
buyList.add(f);
prices = prices + f.getPrice();
}
HttpSession session = request.getSession();
session.setAttribute("buyList", buyList);
session.setAttribute("prices", prices);
return mapping.findForward("success");
}
public ActionForward end_admin(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
return mapping.findForward("success");
}
public ActionForward buy_admin(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String[] names = request.getParameterValues("name");
if (names == null || names.equals("")) {
String str = "你还没有点菜,请先点菜!";
request.setAttribute("str", str);
List food = foodService.findAllFood();
request.setAttribute("foodList", food);
return mapping.findForward("error");
}
List buyList = new ArrayList();
double prices = 0;
for (int i = 0; i < names.length; i++) {
Food f = foodService.findByName(names[i]);
buyList.add(f);
prices = prices + f.getPrice();
}
HttpSession session = request.getSession(true);
session.setAttribute("buyList", buyList);
session.setAttribute("prices", prices);
return mapping.findForward("success");
}
public ActionForward showOrderOne_admin(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
return mapping.findForward("success");
}
public ActionForward orderOne_admin(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String receiveName = request.getParameter("receiveName");
String fullAddress = request.getParameter("fullAddress");
String postalCode = request.getParameter("postalCode");
String mobile = request.getParameter("mobile");
String phone = request.getParameter("phone");
Date date = new Date();
HttpSession session = request.getSession();
session.setAttribute("receiveName", receiveName);
session.setAttribute("fullAddress", fullAddress);
session.setAttribute("postalCode", postalCode);
session.setAttribute("mobile", mobile);
session.setAttribute("phone", phone);
session.setAttribu
没有合适的资源?快使用搜索试试~ 我知道了~
网上快餐系统(试试整合)
共131个文件
jsp:36个
jar:24个
java:21个
5星 · 超过95%的资源 需积分: 9 29 下载量 123 浏览量
2010-10-26
09:00:30
上传
评论
收藏 5.93MB RAR 举报
温馨提示
本系统是一个网上快餐店,当然,这只是一个模拟现实的一个系统,并没有真正的实际应用,是一个可以作为项目实践的资源。内含sql语句的文件。
资源推荐
资源详情
资源评论
收起资源包目录
网上快餐系统(试试整合) (131个子文件)
BuyListAction.class 7KB
FoodManagmentAction.class 6KB
FoodDaoImpl.class 3KB
UserDaoImpl.class 3KB
Order.class 3KB
LoginAction.class 2KB
OrderDaoImpl.class 2KB
Food.class 2KB
UserServiceImpl.class 2KB
FoodServiceImpl.class 2KB
FilterEncoding.class 1KB
User.class 1KB
OrderServiceImpl.class 1KB
UUIDUtils.class 996B
FoodForm.class 962B
UserService.class 518B
UserDao.class 505B
FoodService.class 475B
FoodDao.class 462B
OrderService.class 308B
OrderDao.class 295B
.classpath 2KB
Entries 353B
hibernate3.jar 1.87MB
xerces-2.6.2.jar 972KB
mysql-connector-java-5.0.8-bin.jar 528KB
antlr-2.7.6rc1.jar 427KB
spring-beans.jar 381KB
log4j-1.2.14.jar 359KB
log4j-1.2.11.jar 343KB
dom4j-1.6.1.jar 303KB
cglib-2.1.3.jar 276KB
jaxen-1.1-beta-7.jar 223KB
spring-core.jar 179KB
commons-collections-2.1.1.jar 170KB
spring-context.jar 158KB
xml-apis.jar 121KB
jaas.jar 101KB
commons-logging.jar 52KB
ehcache-1.1.jar 46KB
commons-logging-1.0.4.jar 37KB
commons-attributes-api.jar 36KB
commons-attributes-compiler.jar 29KB
asm.jar 26KB
asm-attrs.jar 17KB
jta.jar 8KB
jdbc2_0-stdext.jar 7KB
BuyListAction.java 9KB
FoodManagmentAction.java 6KB
Order.java 3KB
FoodDaoImpl.java 2KB
UserDaoImpl.java 1KB
LoginAction.java 1KB
Food.java 1KB
OrderDaoImpl.java 996B
UserServiceImpl.java 905B
FoodServiceImpl.java 868B
FilterEncoding.java 828B
User.java 826B
OrderServiceImpl.java 590B
FoodForm.java 533B
UUIDUtils.java 409B
UserService.java 393B
UserDao.java 373B
FoodService.java 355B
FoodDao.java 346B
OrderService.java 217B
OrderDao.java 210B
showOkOrder.jsp 5KB
order_two_admin.jsp 3KB
order_two.jsp 3KB
index.jsp 3KB
order_one_admin.jsp 3KB
order_one.jsp 3KB
main_admin.jsp 2KB
allorder.jsp 2KB
common.jsp 2KB
modify.jsp 1KB
head.jsp 1KB
main_admin_outsize.jsp 1KB
main2_admin.jsp 1KB
main.jsp 1KB
main2.jsp 1KB
todeletefood.jsp 1KB
tomodifyfood.jsp 1KB
main_custorm.jsp 1KB
findallfood.jsp 1KB
buyList_admin.jsp 1KB
buyList.jsp 1KB
buyList2_admin.jsp 1KB
buyList2.jsp 1KB
findfood.jsp 1KB
toaddfood.jsp 1KB
total_order.jsp 1KB
end.jsp 929B
end_admin.jsp 927B
order_fail.jsp 915B
order_ok_admin.jsp 857B
order_ok.jsp 853B
foot1.jsp 690B
共 131 条
- 1
- 2
资源评论
- 隔壁家的粽子2013-03-26还不错,可以跑起来。
- mycrose2013-01-05还不错,可以跑起来。
bijanen19861113
- 粉丝: 8
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功