how2j.cn

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

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

点击下载 winrar5.21
步骤 1 : 先运行,看到效果,再学习   
步骤 2 : 模仿和排错   
步骤 3 : 界面效果   
步骤 4 : ForeServlet.cart()   
步骤 5 : cart.jsp   
步骤 6 : cartPage.jsp   

步骤 1 :

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

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

ForeServlet.cart()

edit
增值内容,请先登录
完整的J2EE模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE一整套技术栈, 从无到有涵盖全部147个知识点,475个开发步骤, 充实J2EE项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
public String cart(HttpServletRequest request, HttpServletResponse response, Page page) { User user =(User) request.getSession().getAttribute("user"); List<OrderItem> ois = orderItemDAO.listByUser(user.getId()); request.setAttribute("ois", ois); return "cart.jsp"; }
package tmall.servlet; import java.io.BufferedWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.util.HtmlUtils; import tmall.bean.Category; import tmall.bean.OrderItem; import tmall.bean.Product; import tmall.bean.ProductImage; import tmall.bean.PropertyValue; import tmall.bean.Review; import tmall.bean.User; import tmall.comparator.ProductAllComparator; import tmall.comparator.ProductDateComparator; import tmall.comparator.ProductPriceComparator; import tmall.comparator.ProductReviewComparator; import tmall.comparator.ProductSaleCountComparator; import tmall.dao.CategoryDAO; import tmall.dao.ProductDAO; import tmall.dao.ProductImageDAO; import tmall.util.Page; public class ForeServlet extends BaseForeServlet { public String home(HttpServletRequest request, HttpServletResponse response, Page page) { List<Category> cs= new CategoryDAO().list(); new ProductDAO().fill(cs); new ProductDAO().fillByRow(cs); request.setAttribute("cs", cs); return "home.jsp"; } public String register(HttpServletRequest request, HttpServletResponse response, Page page) { String name = request.getParameter("name"); String password = request.getParameter("password"); name = HtmlUtils.htmlEscape(name); System.out.println(name); boolean exist = userDAO.isExist(name); if(exist){ request.setAttribute("msg", "用户名已经被使用,不能使用"); return "register.jsp"; } User user = new User(); user.setName(name); user.setPassword(password); System.out.println(user.getName()); System.out.println(user.getPassword()); userDAO.add(user); return "@registerSuccess.jsp"; } public String login(HttpServletRequest request, HttpServletResponse response, Page page) { String name = request.getParameter("name"); name = HtmlUtils.htmlEscape(name); String password = request.getParameter("password"); User user = userDAO.get(name,password); if(null==user){ request.setAttribute("msg", "账号密码错误"); return "login.jsp"; } request.getSession().setAttribute("user", user); return "@forehome"; } public String product(HttpServletRequest request, HttpServletResponse response, Page page) { int pid = Integer.parseInt(request.getParameter("pid")); Product p = productDAO.get(pid); List<ProductImage> productSingleImages = productImageDAO.list(p, ProductImageDAO.type_single); List<ProductImage> productDetailImages = productImageDAO.list(p, ProductImageDAO.type_detail); p.setProductSingleImages(productSingleImages); p.setProductDetailImages(productDetailImages); List<PropertyValue> pvs = propertyValueDAO.list(p.getId()); List<Review> reviews = reviewDAO.list(p.getId()); productDAO.setSaleAndReviewNumber(p); request.setAttribute("reviews", reviews); request.setAttribute("p", p); request.setAttribute("pvs", pvs); return "product.jsp"; } public String logout(HttpServletRequest request, HttpServletResponse response, Page page) { request.getSession().removeAttribute("user"); return "@forehome"; } public String checkLogin(HttpServletRequest request, HttpServletResponse response, Page page) { User user =(User) request.getSession().getAttribute("user"); if(null!=user) return "%success"; return "%fail"; } public String loginAjax(HttpServletRequest request, HttpServletResponse response, Page page) { String name = request.getParameter("name"); String password = request.getParameter("password"); User user = userDAO.get(name,password); if(null==user){ return "%fail"; } request.getSession().setAttribute("user", user); return "%success"; } public String category(HttpServletRequest request, HttpServletResponse response, Page page) { int cid = Integer.parseInt(request.getParameter("cid")); Category c = new CategoryDAO().get(cid); new ProductDAO().fill(c); new ProductDAO().setSaleAndReviewNumber(c.getProducts()); String sort = request.getParameter("sort"); 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; } } request.setAttribute("c", c); return "category.jsp"; } public String search(HttpServletRequest request, HttpServletResponse response, Page page){ String keyword = request.getParameter("keyword"); List<Product> ps= new ProductDAO().search(keyword,0,20); productDAO.setSaleAndReviewNumber(ps); request.setAttribute("ps",ps); return "searchResult.jsp"; } public String buyone(HttpServletRequest request, HttpServletResponse response, Page page) { int pid = Integer.parseInt(request.getParameter("pid")); int num = Integer.parseInt(request.getParameter("num")); Product p = productDAO.get(pid); int oiid = 0; User user =(User) request.getSession().getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemDAO.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId()==p.getId()){ oi.setNumber(oi.getNumber()+num); orderItemDAO.update(oi); found = true; oiid = oi.getId(); break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUser(user); oi.setNumber(num); oi.setProduct(p); orderItemDAO.add(oi); oiid = oi.getId(); } return "@forebuy?oiid="+oiid; } public String buy(HttpServletRequest request, HttpServletResponse response, Page page){ String[] oiids=request.getParameterValues("oiid"); List<OrderItem> ois = new ArrayList<>(); float total = 0; for (String strid : oiids) { int oiid = Integer.parseInt(strid); OrderItem oi= orderItemDAO.get(oiid); total +=oi.getProduct().getPromotePrice()*oi.getNumber(); ois.add(oi); } request.getSession().setAttribute("ois", ois); request.setAttribute("total", total); return "buy.jsp"; } public String addCart(HttpServletRequest request, HttpServletResponse response, Page page) { int pid = Integer.parseInt(request.getParameter("pid")); Product p = productDAO.get(pid); int num = Integer.parseInt(request.getParameter("num")); User user =(User) request.getSession().getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemDAO.listByUser(user.getId()); for (OrderItem oi : ois) { if(oi.getProduct().getId()==p.getId()){ oi.setNumber(oi.getNumber()+num); orderItemDAO.update(oi); found = true; break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUser(user); oi.setNumber(num); oi.setProduct(p); orderItemDAO.add(oi); } return "%success"; } public String cart(HttpServletRequest request, HttpServletResponse response, Page page) { User user =(User) request.getSession().getAttribute("user"); List<OrderItem> ois = orderItemDAO.listByUser(user.getId()); request.setAttribute("ois", ois); return "cart.jsp"; } }
增值内容,请先登录
完整的J2EE模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE一整套技术栈, 从无到有涵盖全部147个知识点,475个开发步骤, 充实J2EE项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
<%@ 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/cartPage.jsp"%> <%@include file="include/footer.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/cartPage.jsp"%>
<%@include file="include/footer.jsp"%>
增值内容,请先登录
完整的J2EE模仿天猫项目,使用J2SE、前端技术(包含所有前端jsp文件)、J2EE一整套技术栈, 从无到有涵盖全部147个知识点,475个开发步骤, 充实J2EE项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
cartPage.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%> <script> var deleteOrderItem = false; var deleteOrderItemid = 0; $(function(){ $("a.deleteOrderItem").click(function(){ deleteOrderItem = false; var oiid = $(this).attr("oiid") deleteOrderItemid = oiid; $("#deleteConfirmModal").modal('show'); }); $("button.deleteConfirmButton").click(function(){ deleteOrderItem = true; $("#deleteConfirmModal").modal('hide'); }); $('#deleteConfirmModal').on('hidden.bs.modal', function (e) { if(deleteOrderItem){ var page="foredeleteOrderItem"; $.post( page, {"oiid":deleteOrderItemid}, function(result){ if("success"==result){ $("tr.cartProductItemTR[oiid="+deleteOrderItemid+"]").hide(); } else{ location.href="login.jsp"; } } ); } }) $("img.cartProductItemIfSelected").click(function(){ var selectit = $(this).attr("selectit") if("selectit"==selectit){ $(this).attr("src","img/site/cartNotSelected.png"); $(this).attr("selectit","false") $(this).parents("tr.cartProductItemTR").css("background-color","#fff"); } else{ $(this).attr("src","img/site/cartSelected.png"); $(this).attr("selectit","selectit") $(this).parents("tr.cartProductItemTR").css("background-color","#FFF8E1"); } syncSelect(); syncCreateOrderButton(); calcCartSumPriceAndNumber(); }); $("img.selectAllItem").click(function(){ var selectit = $(this).attr("selectit") if("selectit"==selectit){ $("img.selectAllItem").attr("src","img/site/cartNotSelected.png"); $("img.selectAllItem").attr("selectit","false") $(".cartProductItemIfSelected").each(function(){ $(this).attr("src","img/site/cartNotSelected.png"); $(this).attr("selectit","false"); $(this).parents("tr.cartProductItemTR").css("background-color","#fff"); }); } else{ $("img.selectAllItem").attr("src","img/site/cartSelected.png"); $("img.selectAllItem").attr("selectit","selectit") $(".cartProductItemIfSelected").each(function(){ $(this).attr("src","img/site/cartSelected.png"); $(this).attr("selectit","selectit"); $(this).parents("tr.cartProductItemTR").css("background-color","#FFF8E1"); }); } syncCreateOrderButton(); calcCartSumPriceAndNumber(); }); $(".orderItemNumberSetting").keyup(function(){ var pid=$(this).attr("pid"); var stock= $("span.orderItemStock[pid="+pid+"]").text(); var price= $("span.orderItemPromotePrice[pid="+pid+"]").text(); var num= $(".orderItemNumberSetting[pid="+pid+"]").val(); num = parseInt(num); if(isNaN(num)) num= 1; if(num<=0) num = 1; if(num>stock) num = stock; syncPrice(pid,num,price); }); $(".numberPlus").click(function(){ var pid=$(this).attr("pid"); var stock= $("span.orderItemStock[pid="+pid+"]").text(); var price= $("span.orderItemPromotePrice[pid="+pid+"]").text(); var num= $(".orderItemNumberSetting[pid="+pid+"]").val(); num++; if(num>stock) num = stock; syncPrice(pid,num,price); }); $(".numberMinus").click(function(){ var pid=$(this).attr("pid"); var stock= $("span.orderItemStock[pid="+pid+"]").text(); var price= $("span.orderItemPromotePrice[pid="+pid+"]").text(); var num= $(".orderItemNumberSetting[pid="+pid+"]").val(); --num; if(num<=0) num=1; syncPrice(pid,num,price); }); $("button.createOrderButton").click(function(){ var params = ""; $(".cartProductItemIfSelected").each(function(){ if("selectit"==$(this).attr("selectit")){ var oiid = $(this).attr("oiid"); params += "&oiid="+oiid; } }); params = params.substring(1); location.href="forebuy?"+params; }); }) function syncCreateOrderButton(){ var selectAny = false; $(".cartProductItemIfSelected").each(function(){ if("selectit"==$(this).attr("selectit")){ selectAny = true; } }); if(selectAny){ $("button.createOrderButton").css("background-color","#C40000"); $("button.createOrderButton").removeAttr("disabled"); } else{ $("button.createOrderButton").css("background-color","#AAAAAA"); $("button.createOrderButton").attr("disabled","disabled"); } } function syncSelect(){ var selectAll = true; $(".cartProductItemIfSelected").each(function(){ if("false"==$(this).attr("selectit")){ selectAll = false; } }); if(selectAll) $("img.selectAllItem").attr("src","img/site/cartSelected.png"); else $("img.selectAllItem").attr("src","img/site/cartNotSelected.png"); } function calcCartSumPriceAndNumber(){ var sum = 0; var totalNumber = 0; $("img.cartProductItemIfSelected[selectit='selectit']").each(function(){ var oiid = $(this).attr("oiid"); var price =$(".cartProductItemSmallSumPrice[oiid="+oiid+"]").text(); price = price.replace(/,/g, ""); price = price.replace(/¥/g, ""); sum += new Number(price); var num =$(".orderItemNumberSetting[oiid="+oiid+"]").val(); totalNumber += new Number(num); }); $("span.cartSumPrice").html("¥"+formatMoney(sum)); $("span.cartTitlePrice").html("¥"+formatMoney(sum)); $("span.cartSumNumber").html(totalNumber); } function syncPrice(pid,num,price){ $(".orderItemNumberSetting[pid="+pid+"]").val(num); var cartProductItemSmallSumPrice = formatMoney(num*price); $(".cartProductItemSmallSumPrice[pid="+pid+"]").html("¥"+cartProductItemSmallSumPrice); calcCartSumPriceAndNumber(); var page = "forechangeOrderItem"; $.post( page, {"pid":pid,"number":num}, function(result){ if("success"!=result){ location.href="login.jsp"; } } ); } </script> <title>购物车</title> <div class="cartDiv"> <div class="cartTitle pull-right"> <span>已选商品 (不含运费)</span> <span class="cartTitlePrice">¥0.00</span> <button class="createOrderButton" disabled="disabled">结 算</button> </div> <div class="cartProductList"> <table class="cartProductTable"> <thead> <tr> <th class="selectAndImage"> <img selectit="false" class="selectAllItem" src="img/site/cartNotSelected.png"> 全选 </th> <th>商品信息</th> <th>单价</th> <th>数量</th> <th width="120px">金额</th> <th class="operation">操作</th> </tr> </thead> <tbody> <c:forEach items="${ois }" var="oi"> <tr oiid="${oi.id}" class="cartProductItemTR"> <td> <img selectit="false" oiid="${oi.id}" class="cartProductItemIfSelected" src="img/site/cartNotSelected.png"> <a style="display:none" href="#nowhere"><img src="img/site/cartSelected.png"></a> <img class="cartProductImg" src="img/productSingle_middle/${oi.product.firstProductImage.id}.jpg"> </td> <td> <div class="cartProductLinkOutDiv"> <a href="foreproduct?pid=${oi.product.id}" class="cartProductLink">${oi.product.name}</a> <div class="cartProductLinkInnerDiv"> <img src="img/site/creditcard.png" title="支持信用卡支付"> <img src="img/site/7day.png" title="消费者保障服务,承诺7天退货"> <img src="img/site/promise.png" title="消费者保障服务,承诺如实描述"> </div> </div> </td> <td> <span class="cartProductItemOringalPrice">¥${oi.product.orignalPrice}</span> <span class="cartProductItemPromotionPrice">¥${oi.product.promotePrice}</span> </td> <td> <div class="cartProductChangeNumberDiv"> <span class="hidden orderItemStock " pid="${oi.product.id}">${oi.product.stock}</span> <span class="hidden orderItemPromotePrice " pid="${oi.product.id}">${oi.product.promotePrice}</span> <a pid="${oi.product.id}" class="numberMinus" href="#nowhere">-</a> <input pid="${oi.product.id}" oiid="${oi.id}" class="orderItemNumberSetting" autocomplete="off" value="${oi.number}"> <a stock="${oi.product.stock}" pid="${oi.product.id}" class="numberPlus" href="#nowhere">+</a> </div> </td> <td > <span class="cartProductItemSmallSumPrice" oiid="${oi.id}" pid="${oi.product.id}" > ¥<fmt:formatNumber type="number" value="${oi.product.promotePrice*oi.number}" minFractionDigits="2"/> </span> </td> <td> <a class="deleteOrderItem" oiid="${oi.id}" href="#nowhere">删除</a> </td> </tr> </c:forEach> </tbody> </table> </div> <div class="cartFoot"> <img selectit="false" class="selectAllItem" src="img/site/cartNotSelected.png"> <span>全选</span> <!-- <a href="#">删除</a> --> <div class="pull-right"> <span>已选商品 <span class="cartSumNumber" >0</span> 件</span> <span>合计 (不含运费): </span> <span class="cartSumPrice" >¥0.00</span> <button class="createOrderButton" disabled="disabled" >结 算</button> </div> </div> </div>


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


问答区域    
2020-04-24 提问
Lz2848509

站长大大 这个‘hidden.bs.modal’是啥? on('hidden.bs.modal', function (e) 还有 这些库存和价格 我可不可以作为属性设置在 比如orderItemNumberSetting上呢?那样通过取属性值也可以得到需要的结果吧




1 个答案

how2j
答案时间:2020-04-25
1. 是bs 中的模态窗口的知识,可前往学习: https://how2j.cn/k/boostrap/boostrap-modal/502.html 2. 根据数据库设计的第三范式, 数据源应该只有一个,当有多个的时候,就容易造成数据冗余和脏数据。



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




2018-10-18 复制站长的代码也出错Uncaught TypeError: $(...).text is not a function
czwbig




不知道为啥,直接下载整个项目才不会出错,复制代码文件到我的工程就出错,选择元素的text()方法不可用,html()方法正常,求解答。
加载中
function calcCartSumPriceAndNumber() {
                var sum = 0;
                var totalNumber = 0;
                $("img.cartProductItemIfSelected[selectit='selectit']").each(function() {
                    var oiid = $(this).attr("oiid");
                    var price = $(".cartProductItemSmallSumPrice[oiid=" + oiid + "]").text();
                    price = price.replace(/,/g, "");
                    price = price.replace(/¥/g, "");
                    sum += new Number(price);

                    var num = $(".orderItemNumberSetting[oiid=" + oiid + "]").val();
                    totalNumber += new Number(num);

                });

                $("span.cartSumPrice").html("¥" + formatMoney(sum));
                $("span.cartTitlePrice").html("¥" + formatMoney(sum));
                $("span.cartSumNumber").html(totalNumber);
            }

function syncPrice(pid, num, price) {
                $(".orderItemNumberSetting[pid=" + pid + "]").val(num);
                var cartProductItemSmallSumPrice = formatMoney(num * price);
                $(".cartProductItemSmallSumPrice[pid=" + pid + "]").html("¥" + cartProductItemSmallSumPrice);
                calcCartSumPriceAndNumber();

                var page = "forechangeOrderItem";
                $.post(page, {
                    "pid": pid,
                    "number": num
                }, function(result) {
                    if ("success" != result) {
                        location.href = "login.jsp";
                    }
                });

            }

$(".numberPlus").click(function () {

            var pid = $(this).attr("pid");
            var stock = $("span.orderItemStock[pid=" + pid + "]").text();
            var price = $("span.orderItemPromotePrice[pid=" + pid + "]").text();
            var num = $(".orderItemNumberSetting[pid=" + pid + "]").val();

            num++;
            if (num > stock)
                num = stock;
            syncPrice(pid, num, price);
        });

<span class="hidden orderItemPromotePrice " pid="89">1439.4</span>
forecart:369 Uncaught TypeError: $(...).text is not a function
    at HTMLImageElement.<anonymous> (forecart:369)
    at Function.each (jquery.min.js:4)
    at init.each (jquery.min.js:4)
    at calcCartSumPriceAndNumber (forecart:367)
    at syncPrice (forecart:388)
    at HTMLAnchorElement.<anonymous> (forecart:300)
    at HTMLAnchorElement.dispatch (jquery.min.js:5)
    at HTMLAnchorElement.y.handle (jquery.min.js:5)


3 个答案

how2j
答案时间:2018-10-20
这个就蛮奇怪了。。。。虽然已经解决了,再试试用 f12 看看加载本地 库是否有报错呢

czwbig
答案时间:2018-10-19
比较过了,不是代码的问题,我用的idea。也不清楚什么原因,最后我删除掉本地应用的jquery和boostrap,直接引用百度的CDN公共库就正常了。
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>

how2j
答案时间:2018-10-19
那你比较一下 会出错与不会出错的代码有什么区别呢 你这样,用diffmerge软件,进行文件夹比较。把你自己做的项目文件夹,和我的可运行项目文件夹进行比较 这个软件很牛逼的,可以知道文件夹里哪两个文件不对,而且很明显地标记出来 我这里就有下载和教程: http://how2j.cn/k/18/18-1583/1583.html



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





2018-08-26 立即购买也会加入购物车
2018-08-23 全选商品后删除订单项,总金额不变
2017-08-29 站长,这个不需要做个登录验证么?




提问之前请登陆
提问已经提交成功,正在审核。 请于 我的提问 处查看提问记录,谢谢
关于 实践项目-天猫整站J2EE-查看购物车页面 的提问

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

上传截图