资源简介
经典ssm框架开发的项目,其中含有重要的知识点,如图片上传等经典知识点,2个积分,绝对物超所值!
代码片段和文件信息
package com.itheima.springmvc.controller;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.itheima.springmvc.exception.MessageException;
import com.itheima.springmvc.pojo.Items;
import com.itheima.springmvc.pojo.QueryVo;
import com.itheima.springmvc.service.ItemService;
/**
* 商品管理
*
* @author lx
*
*/
@Controller
public class ItemController {
@Autowired
private ItemService itemService;
//入门程序 第一 包类 + 类包 + 方法名
/**
* 1.ModelAndView 无敌的 带着数据 返回视图路径 不建议使用
* 2.String 返回视图路径 model带数据 官方推荐此种方式 解耦 数据 视图 分离 MVC 建议使用
* 3.void ajax 请求 合适 json格式数据 (response 异步请求使用
* @return
* @throws MessageException
*/
@RequestMapping(value = {“/item/itemlist.action““/item/itemlisthaha.action“})
public String itemList(Model modelHttpServletRequest requestHttpServletResponse response) throws MessageException{
// Integer i = 1/0;
//从Mysql中查询
List list = itemService.selectItemsList();
// if(null == null){
// throw new MessageException(“商品信息不能为空“);
// }
model.addAttribute(“itemList“ list);
return “itemList“;
}
//去修改页面 入参 id
@RequestMapping(value = “/itemEdit.action“)
// public ModelAndView toEdit(@RequestParam(value = “id“required = falsedefaultValue = “1“) Integer idaaq
public ModelAndView toEdit(Integer id
HttpServletRequest requestHttpServletResponse response
HttpSession sessionModel model){
//Servlet时代开发
// String id = request.getParameter(“id“);
//查询一个商品
// Items items = itemService.selectItemsById(Integer.parseInt(id));
Items items = itemService.selectItemsById(id);
ModelAndView mav = new ModelAndView();
//数据
mav.addobject(“item“ items);
mav.setViewName(“editItem“);
return mav;
}
//提交修改页面 入参 为 Items对象
@RequestMapping(value = “/updateitem.action“)
// public ModelAndView updateitem(Items items){
public String updateitem(QueryVo voMultipartFile pictureFile) throws Except
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 725 2016-11-05 10:59 springmvc-mybatis02\.classpath
文件 1052 2016-11-07 09:07 springmvc-mybatis02\.project
文件 567 2016-11-05 10:34 springmvc-mybatis02\.settings\.jsdtscope
文件 364 2016-11-05 10:34 springmvc-mybatis02\.settings\org.eclipse.jdt.core.prefs
文件 503 2016-11-05 10:34 springmvc-mybatis02\.settings\org.eclipse.wst.common.component
文件 305 2016-11-05 10:34 springmvc-mybatis02\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2016-11-05 10:34 springmvc-mybatis02\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2016-11-05 10:34 springmvc-mybatis02\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 2287 2016-11-05 10:45 springmvc-mybatis02\build\classes\applicationContext.xm
文件 5770 2016-11-07 12:12 springmvc-mybatis02\build\classes\com\itheima\springmvc\controller\ItemController.class
文件 1038 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\conversion\DateConveter.class
文件 1173 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\dao\ItemsMapper.class
文件 9839 2016-11-05 09:51 springmvc-mybatis02\build\classes\com\itheima\springmvc\dao\ItemsMapper.xm
文件 1018 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\dao\UserMapper.class
文件 7760 2016-11-05 09:51 springmvc-mybatis02\build\classes\com\itheima\springmvc\dao\UserMapper.xm
文件 1425 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\exception\CustomExceptionResolver.class
文件 610 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\exception\MessageException.class
文件 2430 2016-11-07 12:10 springmvc-mybatis02\build\classes\com\itheima\springmvc\interceptor\Interceptor1.class
文件 1587 2016-11-07 12:00 springmvc-mybatis02\build\classes\com\itheima\springmvc\interceptor\Interceptor2.class
文件 1742 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\pojo\Items.class
文件 493 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\pojo\ItemsExample$Criteria.class
文件 2212 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\pojo\ItemsExample$Criterion.class
文件 11753 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\pojo\ItemsExample$GeneratedCriteria.class
文件 2225 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\pojo\ItemsExample.class
文件 1362 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\pojo\QueryVo.class
文件 1498 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\pojo\User.class
文件 488 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\pojo\UserExample$Criteria.class
文件 2208 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\pojo\UserExample$Criterion.class
文件 13136 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\pojo\UserExample$GeneratedCriteria.class
文件 2214 2016-11-07 11:19 springmvc-mybatis02\build\classes\com\itheima\springmvc\pojo\UserExample.class
............此处省略106个文件信息
评论
共有 条评论