• 大小: 11.98MB
    文件类型: .zip
    金币: 2
    下载: 0 次
    发布日期: 2024-02-04
  • 语言: Java
  • 标签: SpringMVC  Mybatis  

资源简介

购物网站这个项目是我在学校的java实践项目,项目使用ssm框架,对以后的面试问题很有帮助,源码中关键部分做了注释,仅供参考.首先大体介绍下这个项目实现的内容: ●用户的注册,登录,修改密码界面. ●总商品浏览界面 ●某个商品具体信息界面 ●用户购物车及付款界面 ●数据库(数据库存放着大量的商品,用户信息) 基本上就是仿照淘宝的购物界面,导入数据库再导入源码就可以运行

资源截图

代码片段和文件信息

package cn.edu.neu.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.edu.neu.model.Address;
import cn.edu.neu.service.AddressService;

@Controller
@RequestMapping(“/address“)
public class AddressAction extends baseAction {
@Autowired
private AddressService addressService;

@RequestMapping(“/getMyAddress“)
public String getMyAddress(Map> m){
List
 addrs=addressService.getAddressByUserId(this.getLoginUserId());
m.put(“addrs“ addrs);
return “/address/addressList“;
}

@RequestMapping(“/handleAddress“)
public String handleAddress(Address address){
try{System.out.println(“=======“+address.getAddrId());
if(address.getAddrId()==0){
address.setUserId(this.getLoginUserId());
addressService.addAddress(address);
}
else{
addressService.updateAddress(address);
}
return “forward:/address/getMyAddress“;
}catch(Exception e){
e.printStackTrace();
this.addMessage(“操作收货地址失败“);
this.addRedirURL(“返回“ “@back“);
return EXECUTE_RESULT;
}
}

@RequestMapping(“/delAddress“)
public String delAddress(@RequestParam String addrId){
try{
addressService.delAddress(addrId);
return “forward:/address/getMyAddress“;
}catch(Exception e){
e.printStackTrace();
this.addMessage(“删除收货地址失败“);
this.addRedirURL(“返回“ “@back“);
return EXECUTE_RESULT;
}
}

@ResponseBody
@RequestMapping(“/setDefaultAddress“)
public Map setDefaultAddress(@RequestParam String addrId){
Map m=new HashMap();
try{ 
addressService.setDefaultAddress(addrId);
m.put(“setDefault““success“);
}catch(Exception e){
e.printStackTrace();
m.put(“setDefault““failure“);
}
return m;
}

@ResponseBody
@RequestMapping(“getAddressById“)
public Map getAddressById(@RequestParam String addrId){
Map m=new HashMap();
try{ 
Address addr=addressService.getAddressById(addrId);
m.put(“addr“addr);
}catch(Exception e){
e.printStackTrace();
}
System.out.println(“-------“+m);
return m;
}

////////////////////////////////////////Ajax////////////////////////////////////////////
@RequestMapping(“/getMyAddressAjax“)
public String getMyAddressAjax(Map> m) {
List
 addrs = addressService.getAddressByUserId(this.getLoginUserId());
m.put(“addrs“ addrs);
return “/address/addressListAjax“;
}

@RequestMapping(“/handleAddressAjax“)
public String handleAddressAjax(Address address) {
try {
System.out.println(“=======“ +

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件       64482  2017-08-15 11:40  mybatis.sql
     目录           0  2017-09-07 20:41  shopping\
     文件         849  2016-01-19 08:54  shopping\.classpath
     文件        1041  2017-09-07 20:40  shopping\.project
     目录           0  2017-09-07 20:41  shopping\.settings\
     文件         503  2016-01-16 16:33  shopping\.settings\.jsdtscope
     文件          57  2016-05-20 13:39  shopping\.settings\org.eclipse.core.resources.prefs
     文件         364  2016-01-16 16:33  shopping\.settings\org.eclipse.jdt.core.prefs
     文件         478  2017-09-07 20:40  shopping\.settings\org.eclipse.wst.common.component
     文件         345  2016-01-16 16:33  shopping\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2016-01-16 16:33  shopping\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2016-01-16 16:33  shopping\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2017-09-07 20:41  shopping\build\
     目录           0  2017-09-07 20:41  shopping\build\classes\
     目录           0  2017-09-07 20:41  shopping\build\classes\cn\
     目录           0  2017-09-07 20:41  shopping\build\classes\cn\edu\
     目录           0  2017-09-07 20:41  shopping\build\classes\cn\edu\neu\
     目录           0  2017-09-07 20:41  shopping\build\classes\cn\edu\neu\action\
     文件        4946  2017-09-06 13:57  shopping\build\classes\cn\edu\neu\action\AddressAction.class
     文件        1282  2017-09-06 13:57  shopping\build\classes\cn\edu\neu\action\baseAction.class
     文件        1735  2017-09-06 13:57  shopping\build\classes\cn\edu\neu\action\CateAction.class
     文件        4122  2017-09-06 13:57  shopping\build\classes\cn\edu\neu\action\GoodsAction.class
     文件        1635  2017-09-06 13:57  shopping\build\classes\cn\edu\neu\action\IndexAction.class
     文件        8626  2017-09-06 13:57  shopping\build\classes\cn\edu\neu\action\OrderAction.class
     文件        6303  2017-09-06 13:57  shopping\build\classes\cn\edu\neu\action\UserAction.class
     目录           0  2017-09-07 20:41  shopping\build\classes\cn\edu\neu\core\
     目录           0  2017-09-07 20:41  shopping\build\classes\cn\edu\neu\core\common\
     文件         122  2017-09-06 13:57  shopping\build\classes\cn\edu\neu\core\common\Anonymous.class
     文件         397  2017-09-06 13:57  shopping\build\classes\cn\edu\neu\core\common\CommonAnonymousAction.class
     文件        4902  2017-09-06 13:57  shopping\build\classes\cn\edu\neu\core\common\CommonbaseAction.class
     文件        1365  2017-09-06 13:57  shopping\build\classes\cn\edu\neu\core\common\ExceptionInterceptor.class
............此处省略271个文件信息

评论

共有 条评论