how2j.cn

-->
下载区
文件名 文件大小
请先登录 1m
增值内容 1m
1m

解压rar如果失败,请用5.21版本或者更高版本的winrar

点击下载 winrar5.21
步骤 1 : 先运行,看到效果,再学习   
步骤 2 : 模仿和排错   
步骤 3 : 界面效果   
步骤 4 : 评价产品页面   
步骤 5 : 提交评价   

步骤 1 :

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

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

评价产品页面

edit
增值内容,请先登录
完整的SSM模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSM一整套技术栈, 从无到有涵盖全部126个知识点,560个开发步骤, 充实SSM项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
评价产品页面
@RequestMapping("forereview") public String review( Model model,int oid) { Order o = orderService.get(oid); orderItemService.fill(o); Product p = o.getOrderItems().get(0).getProduct(); List<Review> reviews = reviewService.list(p.getId()); productService.setSaleAndReviewNumber(p); model.addAttribute("p", p); model.addAttribute("o", o); model.addAttribute("reviews", reviews); return "fore/review"; }
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <%@include file="../include/fore/header.jsp"%> <%@include file="../include/fore/top.jsp"%> <%@include file="../include/fore/simpleSearch.jsp"%> <%@include file="../include/fore/cart/reviewPage.jsp"%> <%@include file="../include/fore/footer.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <div class="reviewDiv"> <div class="reviewProductInfoDiv"> <div class="reviewProductInfoImg"><img width="400px" height="400px" src="img/productSingle/${p.firstProductImage.id}.jpg"></div> <div class="reviewProductInfoRightDiv"> <div class="reviewProductInfoRightText"> ${p.name} </div> <table class="reviewProductInfoTable"> <tr> <td width="75px">价格:</td> <td><span class="reviewProductInfoTablePrice">¥<fmt:formatNumber type="number" value="${p.originalPrice}" minFractionDigits="2"/></span> 元 </td> </tr> <tr> <td>配送</td> <td>快递: 0.00</td> </tr> <tr> <td>月销量:</td> <td><span class="reviewProductInfoTableSellNumber">${p.saleCount}</span> 件</td> </tr> </table> <div class="reviewProductInfoRightBelowDiv"> <span class="reviewProductInfoRightBelowImg"><img1 src="img/site/reviewLight.png"></span> <span class="reviewProductInfoRightBelowText" >现在查看的是 您所购买商品的信息 于<fmt:formatDate value="${o.createDate}" pattern="yyyy年MM月dd"/>下单购买了此商品 </span> </div> </div> <div style="clear:both"></div> </div> <div class="reviewStasticsDiv"> <div class="reviewStasticsLeft"> <div class="reviewStasticsLeftTop"></div> <div class="reviewStasticsLeftContent">累计评价 <span class="reviewStasticsNumber"> ${p.reviewCount}</span></div> <div class="reviewStasticsLeftFoot"></div> </div> <div class="reviewStasticsRight"> <div class="reviewStasticsRightEmpty"></div> <div class="reviewStasticsFoot"></div> </div> </div> <c:if test="${param.showonly==true}"> <div class="reviewDivlistReviews"> <c:forEach items="${reviews}" var="r"> <div class="reviewDivlistReviewsEach"> <div class="reviewDate"><fmt:formatDate value="${r.createDate}" pattern="yyyy-MM-dd"/></div> <div class="reviewContent">${r.content}</div> <div class="reviewUserInfo pull-right">${r.user.anonymousName}<span class="reviewUserInfoAnonymous">(匿名)</span></div> </div> </c:forEach> </div> </c:if> <c:if test="${param.showonly!=true}"> <div class="makeReviewDiv"> <form method="post" action="foredoreview"> <div class="makeReviewText">其他买家,需要你的建议哦!</div> <table class="makeReviewTable"> <tr> <td class="makeReviewTableFirstTD">评价商品</td> <td><textarea name="content"></textarea></td> </tr> </table> <div class="makeReviewButtonDiv"> <input type="hidden" name="oid" value="${o.id}"> <input type="hidden" name="pid" value="${p.id}"> <button type="submit">提交评价</button> </div> </form> </div> </c:if> </div>
package com.how2java.tmall.controller; import com.github.pagehelper.PageHelper; import com.how2java.tmall.pojo.*; import com.how2java.tmall.service.*; import comparator.*; import org.apache.commons.lang.math.RandomUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.util.HtmlUtils; import javax.servlet.http.HttpSession; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; @Controller @RequestMapping("") public class ForeController { @Autowired CategoryService categoryService; @Autowired ProductService productService; @Autowired UserService userService; @Autowired ProductImageService productImageService; @Autowired PropertyValueService propertyValueService; @Autowired OrderService orderService; @Autowired OrderItemService orderItemService; @Autowired ReviewService reviewService; @RequestMapping("forehome") public String home(Model model) { List<Category> cs= categoryService.list(); productService.fill(cs); productService.fillByRow(cs); model.addAttribute("cs", cs); return "fore/home"; } @RequestMapping("foreregister") public String register(Model model,User user) { String name = user.getName(); name = HtmlUtils.htmlEscape(name); user.setName(name); boolean exist = userService.isExist(name); if(exist){ String m ="用户名已经被使用,不能使用"; model.addAttribute("msg", m); return "fore/register"; } userService.add(user); return "redirect:registerSuccessPage"; } @RequestMapping("forelogin") public String login(@RequestParam("name") String name, @RequestParam("password") String password, Model model, HttpSession session) { name = HtmlUtils.htmlEscape(name); User user = userService.get(name,password); if(null==user){ model.addAttribute("msg", "账号密码错误"); return "fore/login"; } session.setAttribute("user", user); return "redirect:forehome"; } @RequestMapping("forelogout") public String logout( HttpSession session) { session.removeAttribute("user"); return "redirect:forehome"; } @RequestMapping("foreproduct") public String product( int pid, Model model) { Product p = productService.get(pid); List<ProductImage> productSingleImages = productImageService.list(p.getId(), ProductImageService.type_single); List<ProductImage> productDetailImages = productImageService.list(p.getId(), ProductImageService.type_detail); p.setProductSingleImages(productSingleImages); p.setProductDetailImages(productDetailImages); List<PropertyValue> pvs = propertyValueService.list(p.getId()); List<Review> reviews = reviewService.list(p.getId()); productService.setSaleAndReviewNumber(p); model.addAttribute("reviews", reviews); model.addAttribute("p", p); model.addAttribute("pvs", pvs); return "fore/product"; } @RequestMapping("forecheckLogin") @ResponseBody public String checkLogin( HttpSession session) { User user =(User) session.getAttribute("user"); if(null!=user) return "success"; return "fail"; } @RequestMapping("foreloginAjax") @ResponseBody public String loginAjax(@RequestParam("name") String name, @RequestParam("password") String password,HttpSession session) { name = HtmlUtils.htmlEscape(name); User user = userService.get(name,password); if(null==user){ return "fail"; } session.setAttribute("user", user); return "success"; } @RequestMapping("forecategory") public String category(int cid,String sort, Model model) { Category c = categoryService.get(cid); productService.fill(c); productService.setSaleAndReviewNumber(c.getProducts()); if(null!=sort){ switch(sort){ case "review": Collections.sort(c.getProducts(),new ProductReviewComparator()); break; case "date" : Collections.sort(c.getProducts(),new ProductDateComparator()); break; case "saleCount" : Collections.sort(c.getProducts(),new ProductSaleCountComparator()); break; case "price": Collections.sort(c.getProducts(),new ProductPriceComparator()); break; case "all": Collections.sort(c.getProducts(),new ProductAllComparator()); break; } } model.addAttribute("c", c); return "fore/category"; } @RequestMapping("foresearch") public String search( String keyword,Model model){ PageHelper.offsetPage(0,20); List<Product> ps= productService.search(keyword); productService.setSaleAndReviewNumber(ps); model.addAttribute("ps",ps); return "fore/searchResult"; } @RequestMapping("forebuyone") public String buyone(int pid, int num, HttpSession session) { Product p = productService.get(pid); int oiid = 0; User user =(User) session.getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==p.getId().intValue()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; oiid = oi.getId(); break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUid(user.getId()); oi.setNumber(num); oi.setPid(pid); orderItemService.add(oi); oiid = oi.getId(); } return "redirect:forebuy?oiid="+oiid; } @RequestMapping("forebuy") public String buy( Model model,String[] oiid,HttpSession session){ List<OrderItem> ois = new ArrayList<>(); float total = 0; for (String strid : oiid) { int id = Integer.parseInt(strid); OrderItem oi= orderItemService.get(id); total +=oi.getProduct().getPromotePrice()*oi.getNumber(); ois.add(oi); } session.setAttribute("ois", ois); model.addAttribute("total", total); return "fore/buy"; } @RequestMapping("foreaddCart") @ResponseBody public String addCart(int pid, int num, Model model,HttpSession session) { Product p = productService.get(pid); User user =(User) session.getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==p.getId().intValue()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUid(user.getId()); oi.setNumber(num); oi.setPid(pid); orderItemService.add(oi); } return "success"; } @RequestMapping("forecart") public String cart( Model model,HttpSession session) { User user =(User) session.getAttribute("user"); List<OrderItem> ois = orderItemService.listByUser(user.getId()); model.addAttribute("ois", ois); return "fore/cart"; } @RequestMapping("forechangeOrderItem") @ResponseBody public String changeOrderItem( Model model,HttpSession session, int pid, int number) { User user =(User) session.getAttribute("user"); if(null==user) return "fail"; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==pid){ oi.setNumber(number); orderItemService.update(oi); break; } } return "success"; } @RequestMapping("foredeleteOrderItem") @ResponseBody public String deleteOrderItem( Model model,HttpSession session,int oiid){ User user =(User) session.getAttribute("user"); if(null==user) return "fail"; orderItemService.delete(oiid); return "success"; } @RequestMapping("forecreateOrder") public String createOrder( Model model,Order order,HttpSession session){ User user =(User) session.getAttribute("user"); String orderCode = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + RandomUtils.nextInt(10000); order.setOrderCode(orderCode); order.setCreateDate(new Date()); order.setUid(user.getId()); order.setStatus(OrderService.waitPay); List<OrderItem> ois= (List<OrderItem>) session.getAttribute("ois"); float total =orderService.add(order,ois); return "redirect:forealipay?oid="+order.getId() +"&total="+total; } @RequestMapping("forepayed") public String payed(int oid, float total, Model model) { Order order = orderService.get(oid); order.setStatus(OrderService.waitDelivery); order.setPayDate(new Date()); orderService.update(order); model.addAttribute("o", order); return "fore/payed"; } @RequestMapping("forebought") public String bought( Model model,HttpSession session) { User user =(User) session.getAttribute("user"); List<Order> os= orderService.list(user.getId(),OrderService.delete); orderItemService.fill(os); model.addAttribute("os", os); return "fore/bought"; } @RequestMapping("foreconfirmPay") public String confirmPay( Model model,int oid) { Order o = orderService.get(oid); orderItemService.fill(o); model.addAttribute("o", o); return "fore/confirmPay"; } @RequestMapping("foreorderConfirmed") public String orderConfirmed( Model model,int oid) { Order o = orderService.get(oid); o.setStatus(OrderService.waitReview); o.setConfirmDate(new Date()); orderService.update(o); return "fore/orderConfirmed"; } @RequestMapping("foredeleteOrder") @ResponseBody public String deleteOrder( Model model,int oid){ Order o = orderService.get(oid); o.setStatus(OrderService.delete); orderService.update(o); return "success"; } @RequestMapping("forereview") public String review( Model model,int oid) { Order o = orderService.get(oid); orderItemService.fill(o); Product p = o.getOrderItems().get(0).getProduct(); List<Review> reviews = reviewService.list(p.getId()); productService.setSaleAndReviewNumber(p); model.addAttribute("p", p); model.addAttribute("o", o); model.addAttribute("reviews", reviews); return "fore/review"; } }
增值内容,请先登录
完整的SSM模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE,SSM一整套技术栈, 从无到有涵盖全部126个知识点,560个开发步骤, 充实SSM项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
提交评价
@RequestMapping("foredoreview") public String doreview( Model model,HttpSession session,@RequestParam("oid") int oid,@RequestParam("pid") int pid,String content) { Order o = orderService.get(oid); o.setStatus(OrderService.finish); orderService.update(o); Product p = productService.get(pid); content = HtmlUtils.htmlEscape(content); User user =(User) session.getAttribute("user"); Review review = new Review(); review.setContent(content); review.setPid(pid); review.setCreateDate(new Date()); review.setUid(user.getId()); reviewService.add(review); return "redirect:forereview?oid="+oid+"&showonly=true"; }
<c:if test="${param.showonly==true}"> <div class="reviewDivlistReviews"> <c:forEach items="${reviews}" var="r"> <div class="reviewDivlistReviewsEach"> <div class="reviewDate"><fmt:formatDate value="${r.createDate}" pattern="yyyy-MM-dd"/></div> <div class="reviewContent">${r.content}</div> <div class="reviewUserInfo pull-right">${r.user.anonymousName}<span class="reviewUserInfoAnonymous">(匿名)</span></div> </div> </c:forEach> </div> </c:if>
package com.how2java.tmall.controller; import com.github.pagehelper.PageHelper; import com.how2java.tmall.pojo.*; import com.how2java.tmall.service.*; import comparator.*; import org.apache.commons.lang.math.RandomUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.util.HtmlUtils; import javax.servlet.http.HttpSession; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; @Controller @RequestMapping("") public class ForeController { @Autowired CategoryService categoryService; @Autowired ProductService productService; @Autowired UserService userService; @Autowired ProductImageService productImageService; @Autowired PropertyValueService propertyValueService; @Autowired OrderService orderService; @Autowired OrderItemService orderItemService; @Autowired ReviewService reviewService; @RequestMapping("forehome") public String home(Model model) { List<Category> cs= categoryService.list(); productService.fill(cs); productService.fillByRow(cs); model.addAttribute("cs", cs); return "fore/home"; } @RequestMapping("foreregister") public String register(Model model,User user) { String name = user.getName(); name = HtmlUtils.htmlEscape(name); user.setName(name); boolean exist = userService.isExist(name); if(exist){ String m ="用户名已经被使用,不能使用"; model.addAttribute("msg", m); return "fore/register"; } userService.add(user); return "redirect:registerSuccessPage"; } @RequestMapping("forelogin") public String login(@RequestParam("name") String name, @RequestParam("password") String password, Model model, HttpSession session) { name = HtmlUtils.htmlEscape(name); User user = userService.get(name,password); if(null==user){ model.addAttribute("msg", "账号密码错误"); return "fore/login"; } session.setAttribute("user", user); return "redirect:forehome"; } @RequestMapping("forelogout") public String logout( HttpSession session) { session.removeAttribute("user"); return "redirect:forehome"; } @RequestMapping("foreproduct") public String product( int pid, Model model) { Product p = productService.get(pid); List<ProductImage> productSingleImages = productImageService.list(p.getId(), ProductImageService.type_single); List<ProductImage> productDetailImages = productImageService.list(p.getId(), ProductImageService.type_detail); p.setProductSingleImages(productSingleImages); p.setProductDetailImages(productDetailImages); List<PropertyValue> pvs = propertyValueService.list(p.getId()); List<Review> reviews = reviewService.list(p.getId()); productService.setSaleAndReviewNumber(p); model.addAttribute("reviews", reviews); model.addAttribute("p", p); model.addAttribute("pvs", pvs); return "fore/product"; } @RequestMapping("forecheckLogin") @ResponseBody public String checkLogin( HttpSession session) { User user =(User) session.getAttribute("user"); if(null!=user) return "success"; return "fail"; } @RequestMapping("foreloginAjax") @ResponseBody public String loginAjax(@RequestParam("name") String name, @RequestParam("password") String password,HttpSession session) { name = HtmlUtils.htmlEscape(name); User user = userService.get(name,password); if(null==user){ return "fail"; } session.setAttribute("user", user); return "success"; } @RequestMapping("forecategory") public String category(int cid,String sort, Model model) { Category c = categoryService.get(cid); productService.fill(c); productService.setSaleAndReviewNumber(c.getProducts()); if(null!=sort){ switch(sort){ case "review": Collections.sort(c.getProducts(),new ProductReviewComparator()); break; case "date" : Collections.sort(c.getProducts(),new ProductDateComparator()); break; case "saleCount" : Collections.sort(c.getProducts(),new ProductSaleCountComparator()); break; case "price": Collections.sort(c.getProducts(),new ProductPriceComparator()); break; case "all": Collections.sort(c.getProducts(),new ProductAllComparator()); break; } } model.addAttribute("c", c); return "fore/category"; } @RequestMapping("foresearch") public String search( String keyword,Model model){ PageHelper.offsetPage(0,20); List<Product> ps= productService.search(keyword); productService.setSaleAndReviewNumber(ps); model.addAttribute("ps",ps); return "fore/searchResult"; } @RequestMapping("forebuyone") public String buyone(int pid, int num, HttpSession session) { Product p = productService.get(pid); int oiid = 0; User user =(User) session.getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==p.getId().intValue()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; oiid = oi.getId(); break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUid(user.getId()); oi.setNumber(num); oi.setPid(pid); orderItemService.add(oi); oiid = oi.getId(); } return "redirect:forebuy?oiid="+oiid; } @RequestMapping("forebuy") public String buy( Model model,String[] oiid,HttpSession session){ List<OrderItem> ois = new ArrayList<>(); float total = 0; for (String strid : oiid) { int id = Integer.parseInt(strid); OrderItem oi= orderItemService.get(id); total +=oi.getProduct().getPromotePrice()*oi.getNumber(); ois.add(oi); } session.setAttribute("ois", ois); model.addAttribute("total", total); return "fore/buy"; } @RequestMapping("foreaddCart") @ResponseBody public String addCart(int pid, int num, Model model,HttpSession session) { Product p = productService.get(pid); User user =(User) session.getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==p.getId().intValue()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUid(user.getId()); oi.setNumber(num); oi.setPid(pid); orderItemService.add(oi); } return "success"; } @RequestMapping("forecart") public String cart( Model model,HttpSession session) { User user =(User) session.getAttribute("user"); List<OrderItem> ois = orderItemService.listByUser(user.getId()); model.addAttribute("ois", ois); return "fore/cart"; } @RequestMapping("forechangeOrderItem") @ResponseBody public String changeOrderItem( Model model,HttpSession session, int pid, int number) { User user =(User) session.getAttribute("user"); if(null==user) return "fail"; List<OrderItem> ois = orderItemService.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId().intValue()==pid){ oi.setNumber(number); orderItemService.update(oi); break; } } return "success"; } @RequestMapping("foredeleteOrderItem") @ResponseBody public String deleteOrderItem( Model model,HttpSession session,int oiid){ User user =(User) session.getAttribute("user"); if(null==user) return "fail"; orderItemService.delete(oiid); return "success"; } @RequestMapping("forecreateOrder") public String createOrder( Model model,Order order,HttpSession session){ User user =(User) session.getAttribute("user"); String orderCode = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + RandomUtils.nextInt(10000); order.setOrderCode(orderCode); order.setCreateDate(new Date()); order.setUid(user.getId()); order.setStatus(OrderService.waitPay); List<OrderItem> ois= (List<OrderItem>) session.getAttribute("ois"); float total =orderService.add(order,ois); return "redirect:forealipay?oid="+order.getId() +"&total="+total; } @RequestMapping("forepayed") public String payed(int oid, float total, Model model) { Order order = orderService.get(oid); order.setStatus(OrderService.waitDelivery); order.setPayDate(new Date()); orderService.update(order); model.addAttribute("o", order); return "fore/payed"; } @RequestMapping("forebought") public String bought( Model model,HttpSession session) { User user =(User) session.getAttribute("user"); List<Order> os= orderService.list(user.getId(),OrderService.delete); orderItemService.fill(os); model.addAttribute("os", os); return "fore/bought"; } @RequestMapping("foreconfirmPay") public String confirmPay( Model model,int oid) { Order o = orderService.get(oid); orderItemService.fill(o); model.addAttribute("o", o); return "fore/confirmPay"; } @RequestMapping("foreorderConfirmed") public String orderConfirmed( Model model,int oid) { Order o = orderService.get(oid); o.setStatus(OrderService.waitReview); o.setConfirmDate(new Date()); orderService.update(o); return "fore/orderConfirmed"; } @RequestMapping("foredeleteOrder") @ResponseBody public String deleteOrder( Model model,int oid){ Order o = orderService.get(oid); o.setStatus(OrderService.delete); orderService.update(o); return "success"; } @RequestMapping("forereview") public String review( Model model,int oid) { Order o = orderService.get(oid); orderItemService.fill(o); Product p = o.getOrderItems().get(0).getProduct(); List<Review> reviews = reviewService.list(p.getId()); productService.setSaleAndReviewNumber(p); model.addAttribute("p", p); model.addAttribute("o", o); model.addAttribute("reviews", reviews); return "fore/review"; } @RequestMapping("foredoreview") public String doreview( Model model,HttpSession session,@RequestParam("oid") int oid,@RequestParam("pid") int pid,String content) { Order o = orderService.get(oid); o.setStatus(OrderService.finish); orderService.update(o); Product p = productService.get(pid); content = HtmlUtils.htmlEscape(content); User user =(User) session.getAttribute("user"); Review review = new Review(); review.setContent(content); review.setPid(pid); review.setCreateDate(new Date()); review.setUid(user.getId()); reviewService.add(review); return "redirect:forereview?oid="+oid+"&showonly=true"; } }


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


问答区域    
2020-12-14 站长,这里为啥不显示多个订单项的产品评价功能。。。。
很倒霉的死小孩

如题描述 在天猫中,一个订单的多订单项有多个产品的话,完成之后,每个产品都是可以评价滴,而站长的是第一个产品评价 Product p = o.getOrderItems().get(0).getProduct(); 。。。




1 个答案

how2j
答案时间:2020-12-17
因为每个产品都要评价,页面就太复杂了,学员学起来曲线过陡峭,所以就用第一个产品来做了,这样好理解消化些。 理解掌握之后,有兴趣可以自己开发哈



回答已经提交成功,正在审核。 请于 我的回答 处查看回答记录,谢谢
答案 或者 代码至少填写一项, 如果是自己有问题,请重新提问,否则站长有可能看不到




2020-06-03 关于多用户登录
凝视前方身后的距离

站长你好,我做完这个项目了,在试多用户登录的时候发现一个问题。 我在同一个浏览器登录2个不通的用户,发现这两个用户不能同时登录,而换一个浏览器则可以2个用户同时登录。 这是不是因为我们在登录的时候,对于同一个浏览器,登录不同的用户,服务器会使用同一个Session来保存用户对象。 比如第一个用户登录,服务器创建一个Session,将这个用户数据存储到Session,然后创建jsessionid,用响应头set-cookie将jsessionid传递会浏览器, 浏览器登录不同的用户,通过请求头cookie传递过来的是同一个jsessionid,这样就会使用同一个Session存储新的用户对象,而前一个用户登录的数据就被覆盖? 不知道我这样理解有没有毛病?请站在指点!




1 个答案

how2j
答案时间:2020-06-08
-_- 同一个浏览器当然不能使用两个不同的用户啊,你试试微博, 淘宝看看他们能不能在同一个浏览器使用不同用户呢



回答已经提交成功,正在审核。 请于 我的回答 处查看回答记录,谢谢
答案 或者 代码至少填写一项, 如果是自己有问题,请重新提问,否则站长有可能看不到




2020-05-11 报告一个bug
2020-04-23 跳过确认收货,直接在地址栏输入foredoReview的Controller地址和参数,类似的情况是不是不安全?怎样解决呢?解决方式和form表单的post有关吗
2020-03-26 关于步骤5获取参数的@RequestParam问题


提问太多,页面渲染太慢,为了加快渲染速度,本页最多只显示几条提问。还有 7 条以前的提问,请 点击查看

提问之前请登陆
提问已经提交成功,正在审核。 请于 我的提问 处查看提问记录,谢谢
关于 实践项目-天猫整站SSM-评价产品 的提问

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

上传截图