Skip to content

Commit

Permalink
@lwh110221 整合修改
Browse files Browse the repository at this point in the history
  • Loading branch information
lwh110221 committed Jun 1, 2024
1 parent f189966 commit 3e8c42f
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/com/lwhao/bean/Cart.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public String toString() {
* @param cartItem
*/
public void addItem(CartItem cartItem) {
//先查看购物车中是否包含次商品,如果有的话,数量更新,总金额更新;如果没有,直接放到集合中即可
//先查看购物车中是否包含此商品,如果有的话,数量更新,总金额更新;如果没有,直接放到集合中即可
CartItem item = items.get(cartItem.getId());

if(item == null) {
Expand Down
3 changes: 1 addition & 2 deletions src/com/lwhao/servlet/CartServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ protected void ajaxAddItem(HttpServletRequest req, HttpServletResponse resp) thr
cart.addItem(cartItem);
req.getSession().setAttribute("lastName",cartItem.getName());

//返回购物车总数量和最后一个商品的名称
//返回购物车总数量
Map<String,Object> resultMap = new HashMap<String,Object>();
resultMap.put("totalCount",cart.getTotalCount());
resultMap.put("lastName",cartItem.getName());
Gson gson = new Gson();
String resultMapJsonString = gson.toJson(resultMap);
resp.getWriter().write(resultMapJsonString);
Expand Down
2 changes: 0 additions & 2 deletions src/com/lwhao/servlet/UserServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import java.util.HashMap;
import java.util.Map;

import static com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY;

/**
* @author : Luowenhao221
* @date : 2024/4/30 9:30
Expand Down
Binary file removed web/WEB-INF/lib/kaptcha-2.3.2.jar
Binary file not shown.

0 comments on commit 3e8c42f

Please sign in to comment.