how2j.cn

下载区
文件名 文件大小
请先登录 18m
增值内容 18m
18m
步骤 1 : 先运行,看到效果,再学习   
步骤 2 : 模仿和排错   
步骤 3 : 我的订单页面操作   
步骤 4 : 付款   
步骤 5 : 确认收货   
步骤 6 : 确认收货成功   
步骤 7 : 评价   
步骤 8 : 删除   

步骤 1 :

先运行,看到效果,再学习

edit
增值内容,请先登录
完整的SSH模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSH一整套技术栈, 从无到有涵盖全部133个知识点,571个开发步骤, 充实SSH项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的SSH模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSH一整套技术栈, 从无到有涵盖全部133个知识点,571个开发步骤, 充实SSH项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
步骤 3 :

我的订单页面操作

edit
增值内容,请先登录
完整的SSH模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSH一整套技术栈, 从无到有涵盖全部133个知识点,571个开发步骤, 充实SSH项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
我的订单页面操作
增值内容,请先登录
完整的SSH模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSH一整套技术栈, 从无到有涵盖全部133个知识点,571个开发步骤, 充实SSH项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
付款
增值内容,请先登录
完整的SSH模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSH一整套技术栈, 从无到有涵盖全部133个知识点,571个开发步骤, 充实SSH项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
确认收货
@Action("foreconfirmPay") public String confirmPay() { t2p(order); orderItemService.fill(order); return "confirmPay.jsp"; }
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <%@include file="include/header.jsp"%> <%@include file="include/top.jsp"%> <%@include file="include/simpleSearch.jsp"%> <%@include file="include/cart/confirmPayPage.jsp"%> <%@include file="include/footer.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <div class="confirmPayPageDiv"> <div class="confirmPayImageDiv"> <img src="img/site/comformPayFlow.png"> <div class="confirmPayTime1"> <fmt:formatDate value="${order.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/> </div> <div class="confirmPayTime2"> <fmt:formatDate value="${order.payDate}" pattern="yyyy-MM-dd HH:mm:ss"/> </div> <div class="confirmPayTime3"> yyyy-MM-dd HH:mm:ss </div> </div> <div class="confirmPayOrderInfoDiv"> <div class="confirmPayOrderInfoText">我已收到货,同意支付宝付款</div> </div> <div class="confirmPayOrderItemDiv"> <div class="confirmPayOrderItemText">订单信息</div> <table class="confirmPayOrderItemTable"> <thead> <th colspan="2">宝贝</th> <th width="120px">单价</th> <th width="120px">数量</th> <th width="120px">商品总价 </th> <th width="120px">运费</th> </thead> <c:forEach items="${order.orderItems}" var="oi"> <tr> <td><img width="50px" src="img/productSingle_middle/${oi.product.firstProductImage.id}.jpg"></td> <td class="confirmPayOrderItemProductLink"> <a href="#nowhere">${oi.product.name}</a> </td> <td>¥<fmt:formatNumber type="number" value="${oi.product.originalPrice}" minFractionDigits="2"/></td> <td>1</td> <td><span class="conformPayProductPrice">¥<fmt:formatNumber type="number" value="${oi.product.promotePrice}" minFractionDigits="2"/></span></td> <td><span>快递 : 0.00 </span></td> </tr> </c:forEach> </table> <div class="confirmPayOrderItemText pull-right"> 实付款: <span class="confirmPayOrderItemSumPrice">¥<fmt:formatNumber type="number" value="${order.total}" minFractionDigits="2"/></span> </div> </div> <div class="confirmPayOrderDetailDiv"> <table class="confirmPayOrderDetailTable"> <tr> <td>订单编号:</td> <td>${order.orderCode} <img width="23px" src="img/site/confirmOrderTmall.png"></td> </tr> <tr> <td>卖家昵称:</td> <td>天猫商铺 <span class="confirmPayOrderDetailWangWangGif"></span></td> </tr> <tr> <td>收货信息: </td> <td>${order.address},${order.receiver}, ${order.mobile},${order.post} </td> </tr> <tr> <td>成交时间:</td> <td><fmt:formatDate value="${order.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td> </tr> </table> </div> <div class="confirmPayButtonDiv"> <div class="confirmPayWarning">请收到货后,再确认收货!否则您可能钱货两空!</div> <a href="foreorderConfirmed?order.id=${order.id}"><button class="confirmPayButton">确认支付</button></a> </div> </div>
package com.how2java.tmall.action; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import org.apache.commons.lang.xwork.math.RandomUtils; import org.apache.struts2.convention.annotation.Action; import org.springframework.web.util.HtmlUtils; import com.how2java.tmall.comparator.ProductAllComparator; import com.how2java.tmall.comparator.ProductDateComparator; import com.how2java.tmall.comparator.ProductPriceComparator; import com.how2java.tmall.comparator.ProductReviewComparator; import com.how2java.tmall.comparator.ProductSaleCountComparator; import com.how2java.tmall.pojo.OrderItem; import com.how2java.tmall.pojo.Product; import com.how2java.tmall.pojo.User; import com.how2java.tmall.service.OrderService; import com.how2java.tmall.service.ProductImageService; import com.opensymphony.xwork2.ActionContext; public class ForeAction extends Action4Result { @Action("foreconfirmPay") public String confirmPay() { t2p(order); orderItemService.fill(order); return "confirmPay.jsp"; } @Action("forebought") public String bought() { User user =(User) ActionContext.getContext().getSession().get("user"); orders= orderService.listByUserWithoutDelete(user); orderItemService.fill(orders); return "bought.jsp"; } @Action("forepayed") public String payed() { t2p(order); order.setStatus(OrderService.waitDelivery); order.setPayDate(new Date()); orderService.update(order); return "payed.jsp"; } @Action("forealipay") public String forealipay(){ return "alipay.jsp"; } @Action("forecreateOrder") public String createOrder(){ List<OrderItem> ois= (List<OrderItem>) ActionContext.getContext().getSession().get("orderItems"); if(ois.isEmpty()) return "login.jsp"; User user =(User) ActionContext.getContext().getSession().get("user"); String orderCode = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) +RandomUtils.nextInt(10000); order.setOrderCode(orderCode); order.setCreateDate(new Date()); order.setUser(user); order.setStatus(OrderService.waitPay); total = orderService.createOrder(order, ois); return "alipayPage"; } @Action("foredeleteOrderItem") public String deleteOrderItem(){ orderItemService.delete(orderItem); return "success.jsp"; } @Action("forechangeOrderItem") public String changeOrderItem() { User user =(User) ActionContext.getContext().getSession().get("user"); List<OrderItem> ois = orderItemService.list("user",user,"order", null); for (OrderItem oi : ois) { if(oi.getProduct().getId()==product.getId()){ oi.setNumber(num); orderItemService.update(oi); break; } } return "success.jsp"; } @Action("forecart") public String cart() { User user =(User) ActionContext.getContext().getSession().get("user"); orderItems = orderItemService.list("user",user,"order", null); for (OrderItem orderItem : orderItems) productImageService.setFirstProdutImage(orderItem.getProduct()); return "cart.jsp"; } @Action("foreaddCart") public String addCart() { User user =(User) ActionContext.getContext().getSession().get("user"); boolean found = false; List<OrderItem> ois = orderItemService.list("user",user,"order", null); for (OrderItem oi : ois) { if(oi.getProduct().getId()==product.getId()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUser(user); oi.setNumber(num); oi.setProduct(product); orderItemService.save(oi); } return "success.jsp"; } @Action("forebuy") public String buy() { orderItems = new ArrayList<>(); for (int oiid : oiids) { OrderItem oi= (OrderItem) orderItemService.get(oiid); total +=oi.getProduct().getPromotePrice()*oi.getNumber(); orderItems.add(oi); productImageService.setFirstProdutImage(oi.getProduct()); } ActionContext.getContext().getSession().put("orderItems", orderItems); return "buy.jsp"; } @Action("forebuyone") public String buyone() { User user =(User) ActionContext.getContext().getSession().get("user"); boolean found = false; List<OrderItem> ois = orderItemService.list("user",user,"order", null); for (OrderItem oi : ois) { if(oi.getProduct().getId()==product.getId()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; oiid = oi.getId(); break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUser(user); oi.setNumber(num); oi.setProduct(product); orderItemService.save(oi); oiid = oi.getId(); } return "buyPage"; } @Action("foresearch") public String search(){ products= productService.search(keyword,0,20); productService.setSaleAndReviewNumber(products); for (Product product : products) productImageService.setFirstProdutImage(product); return "searchResult.jsp"; } @Action("forecategory") public String category(){ t2p(category); productService.fill(category); productService.setSaleAndReviewNumber(category.getProducts()); if(null!=sort){ switch(sort){ case "review": Collections.sort(category.getProducts(),new ProductReviewComparator()); break; case "date" : Collections.sort(category.getProducts(),new ProductDateComparator()); break; case "saleCount" : Collections.sort(category.getProducts(),new ProductSaleCountComparator()); break; case "price": Collections.sort(category.getProducts(),new ProductPriceComparator()); break; case "all": Collections.sort(category.getProducts(),new ProductAllComparator()); break; } } return "category.jsp"; } @Action("foreloginAjax") public String loginAjax() { user.setName(HtmlUtils.htmlEscape(user.getName())); User user_session = userService.get(user.getName(),user.getPassword()); if(null==user_session) return "fail.jsp"; ActionContext.getContext().getSession().put("user", user_session); return "success.jsp"; } @Action("forecheckLogin") public String checkLogin() { User u =(User) ActionContext.getContext().getSession().get("user"); if(null==u) return "fail.jsp"; else return "success.jsp"; } @Action("foreproduct") public String product() { t2p(product); productImageService.setFirstProdutImage(product); productSingleImages = productImageService.list("product",product,"type", ProductImageService.type_single); productDetailImages = productImageService.list("product",product,"type", ProductImageService.type_detail); product.setProductSingleImages(productSingleImages); product.setProductDetailImages(productDetailImages); propertyValues = propertyValueService.listByParent(product); reviews = reviewService.listByParent(product); productService.setSaleAndReviewNumber(product); return "product.jsp"; } @Action("forelogout") public String logout() { ActionContext.getContext().getSession().remove("user"); return "homePage"; } @Action("forelogin") public String login() { user.setName(HtmlUtils.htmlEscape(user.getName())); User user_session = userService.get(user.getName(),user.getPassword()); if(null==user_session){ msg= "账号密码错误"; return "login.jsp"; } ActionContext.getContext().getSession().put("user", user_session); return "homePage"; } @Action("foreregister") public String register() { user.setName(HtmlUtils.htmlEscape(user.getName())); boolean exist = userService.isExist(user.getName()); if(exist){ msg = "用户名已经被使用,不能使用"; return "register.jsp"; } userService.save(user); return "registerSuccessPage"; } @Action("forehome") public String home() { categorys = categoryService.list(); productService.fill(categorys); productService.fillByRow(categorys); return "home.jsp"; } }
步骤 6 :

确认收货成功

edit
增值内容,请先登录
完整的SSH模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSH一整套技术栈, 从无到有涵盖全部133个知识点,571个开发步骤, 充实SSH项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
@Action("foreorderConfirmed") public String orderConfirmed() { t2p(order); order.setStatus(OrderService.waitReview); order.setConfirmDate(new Date()); orderService.update(order); return "orderConfirmed.jsp"; }
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <%@include file="include/header.jsp"%> <%@include file="include/top.jsp"%> <%@include file="include/simpleSearch.jsp"%> <%@include file="include/cart/orderConfirmedPage.jsp"%> <%@include file="include/footer.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <div class="orderFinishDiv"> <div class="orderFinishTextDiv"> <img src="img/site/orderFinish.png"> <span>交易已经成功,卖家将收到您的货款。</span> </div> </div>
package com.how2java.tmall.action; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import org.apache.commons.lang.xwork.math.RandomUtils; import org.apache.struts2.convention.annotation.Action; import org.springframework.web.util.HtmlUtils; import com.how2java.tmall.comparator.ProductAllComparator; import com.how2java.tmall.comparator.ProductDateComparator; import com.how2java.tmall.comparator.ProductPriceComparator; import com.how2java.tmall.comparator.ProductReviewComparator; import com.how2java.tmall.comparator.ProductSaleCountComparator; import com.how2java.tmall.pojo.OrderItem; import com.how2java.tmall.pojo.Product; import com.how2java.tmall.pojo.User; import com.how2java.tmall.service.OrderService; import com.how2java.tmall.service.ProductImageService; import com.opensymphony.xwork2.ActionContext; public class ForeAction extends Action4Result { @Action("foreorderConfirmed") public String orderConfirmed() { t2p(order); order.setStatus(OrderService.waitReview); order.setConfirmDate(new Date()); orderService.update(order); return "orderConfirmed.jsp"; } @Action("foreconfirmPay") public String confirmPay() { t2p(order); orderItemService.fill(order); return "confirmPay.jsp"; } @Action("forebought") public String bought() { User user =(User) ActionContext.getContext().getSession().get("user"); orders= orderService.listByUserWithoutDelete(user); orderItemService.fill(orders); return "bought.jsp"; } @Action("forepayed") public String payed() { t2p(order); order.setStatus(OrderService.waitDelivery); order.setPayDate(new Date()); orderService.update(order); return "payed.jsp"; } @Action("forealipay") public String forealipay(){ return "alipay.jsp"; } @Action("forecreateOrder") public String createOrder(){ List<OrderItem> ois= (List<OrderItem>) ActionContext.getContext().getSession().get("orderItems"); if(ois.isEmpty()) return "login.jsp"; User user =(User) ActionContext.getContext().getSession().get("user"); String orderCode = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) +RandomUtils.nextInt(10000); order.setOrderCode(orderCode); order.setCreateDate(new Date()); order.setUser(user); order.setStatus(OrderService.waitPay); total = orderService.createOrder(order, ois); return "alipayPage"; } @Action("foredeleteOrderItem") public String deleteOrderItem(){ orderItemService.delete(orderItem); return "success.jsp"; } @Action("forechangeOrderItem") public String changeOrderItem() { User user =(User) ActionContext.getContext().getSession().get("user"); List<OrderItem> ois = orderItemService.list("user",user,"order", null); for (OrderItem oi : ois) { if(oi.getProduct().getId()==product.getId()){ oi.setNumber(num); orderItemService.update(oi); break; } } return "success.jsp"; } @Action("forecart") public String cart() { User user =(User) ActionContext.getContext().getSession().get("user"); orderItems = orderItemService.list("user",user,"order", null); for (OrderItem orderItem : orderItems) productImageService.setFirstProdutImage(orderItem.getProduct()); return "cart.jsp"; } @Action("foreaddCart") public String addCart() { User user =(User) ActionContext.getContext().getSession().get("user"); boolean found = false; List<OrderItem> ois = orderItemService.list("user",user,"order", null); for (OrderItem oi : ois) { if(oi.getProduct().getId()==product.getId()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUser(user); oi.setNumber(num); oi.setProduct(product); orderItemService.save(oi); } return "success.jsp"; } @Action("forebuy") public String buy() { orderItems = new ArrayList<>(); for (int oiid : oiids) { OrderItem oi= (OrderItem) orderItemService.get(oiid); total +=oi.getProduct().getPromotePrice()*oi.getNumber(); orderItems.add(oi); productImageService.setFirstProdutImage(oi.getProduct()); } ActionContext.getContext().getSession().put("orderItems", orderItems); return "buy.jsp"; } @Action("forebuyone") public String buyone() { User user =(User) ActionContext.getContext().getSession().get("user"); boolean found = false; List<OrderItem> ois = orderItemService.list("user",user,"order", null); for (OrderItem oi : ois) { if(oi.getProduct().getId()==product.getId()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; oiid = oi.getId(); break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUser(user); oi.setNumber(num); oi.setProduct(product); orderItemService.save(oi); oiid = oi.getId(); } return "buyPage"; } @Action("foresearch") public String search(){ products= productService.search(keyword,0,20); productService.setSaleAndReviewNumber(products); for (Product product : products) productImageService.setFirstProdutImage(product); return "searchResult.jsp"; } @Action("forecategory") public String category(){ t2p(category); productService.fill(category); productService.setSaleAndReviewNumber(category.getProducts()); if(null!=sort){ switch(sort){ case "review": Collections.sort(category.getProducts(),new ProductReviewComparator()); break; case "date" : Collections.sort(category.getProducts(),new ProductDateComparator()); break; case "saleCount" : Collections.sort(category.getProducts(),new ProductSaleCountComparator()); break; case "price": Collections.sort(category.getProducts(),new ProductPriceComparator()); break; case "all": Collections.sort(category.getProducts(),new ProductAllComparator()); break; } } return "category.jsp"; } @Action("foreloginAjax") public String loginAjax() { user.setName(HtmlUtils.htmlEscape(user.getName())); User user_session = userService.get(user.getName(),user.getPassword()); if(null==user_session) return "fail.jsp"; ActionContext.getContext().getSession().put("user", user_session); return "success.jsp"; } @Action("forecheckLogin") public String checkLogin() { User u =(User) ActionContext.getContext().getSession().get("user"); if(null==u) return "fail.jsp"; else return "success.jsp"; } @Action("foreproduct") public String product() { t2p(product); productImageService.setFirstProdutImage(product); productSingleImages = productImageService.list("product",product,"type", ProductImageService.type_single); productDetailImages = productImageService.list("product",product,"type", ProductImageService.type_detail); product.setProductSingleImages(productSingleImages); product.setProductDetailImages(productDetailImages); propertyValues = propertyValueService.listByParent(product); reviews = reviewService.listByParent(product); productService.setSaleAndReviewNumber(product); return "product.jsp"; } @Action("forelogout") public String logout() { ActionContext.getContext().getSession().remove("user"); return "homePage"; } @Action("forelogin") public String login() { user.setName(HtmlUtils.htmlEscape(user.getName())); User user_session = userService.get(user.getName(),user.getPassword()); if(null==user_session){ msg= "账号密码错误"; return "login.jsp"; } ActionContext.getContext().getSession().put("user", user_session); return "homePage"; } @Action("foreregister") public String register() { user.setName(HtmlUtils.htmlEscape(user.getName())); boolean exist = userService.isExist(user.getName()); if(exist){ msg = "用户名已经被使用,不能使用"; return "register.jsp"; } userService.save(user); return "registerSuccessPage"; } @Action("forehome") public String home() { categorys = categoryService.list(); productService.fill(categorys); productService.fillByRow(categorys); return "home.jsp"; } }
增值内容,请先登录
完整的SSH模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSH一整套技术栈, 从无到有涵盖全部133个知识点,571个开发步骤, 充实SSH项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的SSH模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSH一整套技术栈, 从无到有涵盖全部133个知识点,571个开发步骤, 充实SSH项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
删除
var page="foredeleteOrder"; $.post( page, {"order.id":deleteOrderid}, function(result){ if("success"==result){ $("table.orderListItemTable[oid="+deleteOrderid+"]").hide(); } else{ location.href="login.jsp"; } } );
@Action("foredeleteOrder") public String deleteOrder(){ t2p(order); order.setStatus(OrderService.delete); orderService.update(order); return "success.jsp"; }
package com.how2java.tmall.action; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import org.apache.commons.lang.xwork.math.RandomUtils; import org.apache.struts2.convention.annotation.Action; import org.springframework.web.util.HtmlUtils; import com.how2java.tmall.comparator.ProductAllComparator; import com.how2java.tmall.comparator.ProductDateComparator; import com.how2java.tmall.comparator.ProductPriceComparator; import com.how2java.tmall.comparator.ProductReviewComparator; import com.how2java.tmall.comparator.ProductSaleCountComparator; import com.how2java.tmall.pojo.OrderItem; import com.how2java.tmall.pojo.Product; import com.how2java.tmall.pojo.User; import com.how2java.tmall.service.OrderService; import com.how2java.tmall.service.ProductImageService; import com.opensymphony.xwork2.ActionContext; public class ForeAction extends Action4Result { @Action("foredeleteOrder") public String deleteOrder(){ t2p(order); order.setStatus(OrderService.delete); orderService.update(order); return "success.jsp"; } @Action("foreorderConfirmed") public String orderConfirmed() { t2p(order); order.setStatus(OrderService.waitReview); order.setConfirmDate(new Date()); orderService.update(order); return "orderConfirmed.jsp"; } @Action("foreconfirmPay") public String confirmPay() { t2p(order); orderItemService.fill(order); return "confirmPay.jsp"; } @Action("forebought") public String bought() { User user =(User) ActionContext.getContext().getSession().get("user"); orders= orderService.listByUserWithoutDelete(user); orderItemService.fill(orders); return "bought.jsp"; } @Action("forepayed") public String payed() { t2p(order); order.setStatus(OrderService.waitDelivery); order.setPayDate(new Date()); orderService.update(order); return "payed.jsp"; } @Action("forealipay") public String forealipay(){ return "alipay.jsp"; } @Action("forecreateOrder") public String createOrder(){ List<OrderItem> ois= (List<OrderItem>) ActionContext.getContext().getSession().get("orderItems"); if(ois.isEmpty()) return "login.jsp"; User user =(User) ActionContext.getContext().getSession().get("user"); String orderCode = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) +RandomUtils.nextInt(10000); order.setOrderCode(orderCode); order.setCreateDate(new Date()); order.setUser(user); order.setStatus(OrderService.waitPay); total = orderService.createOrder(order, ois); return "alipayPage"; } @Action("foredeleteOrderItem") public String deleteOrderItem(){ orderItemService.delete(orderItem); return "success.jsp"; } @Action("forechangeOrderItem") public String changeOrderItem() { User user =(User) ActionContext.getContext().getSession().get("user"); List<OrderItem> ois = orderItemService.list("user",user,"order", null); for (OrderItem oi : ois) { if(oi.getProduct().getId()==product.getId()){ oi.setNumber(num); orderItemService.update(oi); break; } } return "success.jsp"; } @Action("forecart") public String cart() { User user =(User) ActionContext.getContext().getSession().get("user"); orderItems = orderItemService.list("user",user,"order", null); for (OrderItem orderItem : orderItems) productImageService.setFirstProdutImage(orderItem.getProduct()); return "cart.jsp"; } @Action("foreaddCart") public String addCart() { User user =(User) ActionContext.getContext().getSession().get("user"); boolean found = false; List<OrderItem> ois = orderItemService.list("user",user,"order", null); for (OrderItem oi : ois) { if(oi.getProduct().getId()==product.getId()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUser(user); oi.setNumber(num); oi.setProduct(product); orderItemService.save(oi); } return "success.jsp"; } @Action("forebuy") public String buy() { orderItems = new ArrayList<>(); for (int oiid : oiids) { OrderItem oi= (OrderItem) orderItemService.get(oiid); total +=oi.getProduct().getPromotePrice()*oi.getNumber(); orderItems.add(oi); productImageService.setFirstProdutImage(oi.getProduct()); } ActionContext.getContext().getSession().put("orderItems", orderItems); return "buy.jsp"; } @Action("forebuyone") public String buyone() { User user =(User) ActionContext.getContext().getSession().get("user"); boolean found = false; List<OrderItem> ois = orderItemService.list("user",user,"order", null); for (OrderItem oi : ois) { if(oi.getProduct().getId()==product.getId()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; oiid = oi.getId(); break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUser(user); oi.setNumber(num); oi.setProduct(product); orderItemService.save(oi); oiid = oi.getId(); } return "buyPage"; } @Action("foresearch") public String search(){ products= productService.search(keyword,0,20); productService.setSaleAndReviewNumber(products); for (Product product : products) productImageService.setFirstProdutImage(product); return "searchResult.jsp"; } @Action("forecategory") public String category(){ t2p(category); productService.fill(category); productService.setSaleAndReviewNumber(category.getProducts()); if(null!=sort){ switch(sort){ case "review": Collections.sort(category.getProducts(),new ProductReviewComparator()); break; case "date" : Collections.sort(category.getProducts(),new ProductDateComparator()); break; case "saleCount" : Collections.sort(category.getProducts(),new ProductSaleCountComparator()); break; case "price": Collections.sort(category.getProducts(),new ProductPriceComparator()); break; case "all": Collections.sort(category.getProducts(),new ProductAllComparator()); break; } } return "category.jsp"; } @Action("foreloginAjax") public String loginAjax() { user.setName(HtmlUtils.htmlEscape(user.getName())); User user_session = userService.get(user.getName(),user.getPassword()); if(null==user_session) return "fail.jsp"; ActionContext.getContext().getSession().put("user", user_session); return "success.jsp"; } @Action("forecheckLogin") public String checkLogin() { User u =(User) ActionContext.getContext().getSession().get("user"); if(null==u) return "fail.jsp"; else return "success.jsp"; } @Action("foreproduct") public String product() { t2p(product); productImageService.setFirstProdutImage(product); productSingleImages = productImageService.list("product",product,"type", ProductImageService.type_single); productDetailImages = productImageService.list("product",product,"type", ProductImageService.type_detail); product.setProductSingleImages(productSingleImages); product.setProductDetailImages(productDetailImages); propertyValues = propertyValueService.listByParent(product); reviews = reviewService.listByParent(product); productService.setSaleAndReviewNumber(product); return "product.jsp"; } @Action("forelogout") public String logout() { ActionContext.getContext().getSession().remove("user"); return "homePage"; } @Action("forelogin") public String login() { user.setName(HtmlUtils.htmlEscape(user.getName())); User user_session = userService.get(user.getName(),user.getPassword()); if(null==user_session){ msg= "账号密码错误"; return "login.jsp"; } ActionContext.getContext().getSession().put("user", user_session); return "homePage"; } @Action("foreregister") public String register() { user.setName(HtmlUtils.htmlEscape(user.getName())); boolean exist = userService.isExist(user.getName()); if(exist){ msg = "用户名已经被使用,不能使用"; return "register.jsp"; } userService.save(user); return "registerSuccessPage"; } @Action("forehome") public String home() { categorys = categoryService.list(); productService.fill(categorys); productService.fillByRow(categorys); return "home.jsp"; } }


HOW2J公众号,关注后实时获知最新的教程和优惠活动,谢谢。


提问之前请登陆
提问已经提交成功,正在审核。 请于 我的提问 处查看提问记录,谢谢
关于 已下架实践项目-天猫整站SSH-我的订单页操作 的提问

尽量提供截图代码异常信息,有助于分析和解决问题。 也可进本站QQ群交流: 578362961
提问尽量提供完整的代码,环境描述,越是有利于问题的重现,您的问题越能更快得到解答。
对教程中代码有疑问,请提供是哪个步骤,哪一行有疑问,这样便于快速定位问题,提高问题得到解答的速度
在已经存在的几千个提问里,有相当大的比例,是因为使用了和站长不同版本的开发环境导致的,比如 jdk, eclpise, idea, mysql,tomcat 等等软件的版本不一致。
请使用和站长一样的版本,可以节约自己大量的学习时间。 站长把教学中用的软件版本整理了,都统一放在了这里, 方便大家下载: https://how2j.cn/k/helloworld/helloworld-version/1718.html

上传截图