首页>代码>基于SSM框架简单的商城购物车项目实例>/超市项目/shopcart/src/cn/sjzedu/controller/CashController.java
package cn.sjzedu.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import cn.sjzedu.pack.CashContext;
import cn.sjzedu.service.CartService;


@Controller
@RequestMapping("/Cash")
public class CashController {
	@Autowired
	private CartService cartService;
	//在结算界面点结算跳转的controller
	@RequestMapping("/accountcash")
	public String accountcash(HttpServletRequest req,HttpServletResponse rsp) throws Exception{
		ModelAndView modelAndView = new ModelAndView();
		int ret = cartService.deleteAll();
		String url = "";
		if(ret>0){
			modelAndView.addObject("alert", "结算成功,继续购物");
			//如果结算成功,则返回购物界面并带着一个参数i
			//为的是在购物界根据不同的问题显示不同的提示语句
			url = "redirect:/showgoods.action?i=3";
		}else{
			modelAndView.addObject("alert", "结算失败");
			url = "account";
		}
		return url;
		
	}
}
最近下载更多
taoshen95  LV14 3月22日
gecongkai  LV8 2023年6月22日
yzshabzbbdvw  LV4 2023年4月15日
malike  LV3 2022年12月14日
lsglsg9  LV22 2022年11月26日
微信网友_6200823191523328  LV3 2022年11月11日
admin0108  LV9 2022年10月12日
1020132795  LV5 2022年9月25日
chj1234  LV4 2022年9月16日
13605416728  LV4 2022年6月20日
最近浏览更多
pangzhihui  LV12 前天
xiexin  LV1 4月13日
wddq123 4月2日
暂无贡献等级
xiongM  LV3 4月1日
xiaojie93  LV2 3月1日
lihao0217  LV1 2月15日
liiiyou  LV1 1月26日
戴凯凡 1月23日
暂无贡献等级
a2418735612  LV1 1月4日
潘潘123456  LV2 2023年12月30日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友