资源简介
基于注解的Spring_mvc增删改DEMO源码
代码片段和文件信息
package com.mvc.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.servlet.ModelAndView;
import com.mvc.entity.Student;
import com.mvc.service.StudentService;
@Controller
@RequestMapping(“/student.do“)
public class StudentController {
protected final transient Log log = LogFactory
.getLog(StudentController.class);
@Autowired
private StudentService studentService;
public StudentController(){
}
@RequestMapping
public String load(ModelMap modelMap){
Listject> list = studentService.getStudentList();
modelMap.put(“list“ list);
return “student“;
}
@RequestMapping(params = “method=add“)
public String add(HttpServletRequest request ModelMap modelMap) throws Exception{
return “student_add“;
}
@RequestMapping(params = “method=save“)
public String save(HttpServletRequest request ModelMap modelMap){
String user = request.getParameter(“user“);
String psw = request.getParameter(“psw“);
Student st = new Student();
st.setUser(user);
st.setPsw(psw);
try{
studentService.save(st);
modelMap.put(“addstate“ “添加成功“);
}
catch(Exception e){
log.error(e.getMessage());
modelMap.put(“addstate“ “添加失败“);
}
return “student_add“;
}
@RequestMapping(params = “method=del“)
public void del(@RequestParam(“id“) String id HttpServletResponse response){
try{
Student st = new Student();
st.setId(Integer.valueOf(id));
studentService.delete(st);
response.getWriter().print(“{\“del\“:\“true\“}“);
}
catch(Exception e){
log.error(e.getMessage());
e.printStackTrace();
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 848 2010-11-26 23:32 s3h3\.classpath
文件 1037 2010-11-26 23:32 s3h3\.project
文件 454 2010-11-26 23:32 s3h3\.settings\.jsdtscope
文件 330 2010-11-26 23:32 s3h3\.settings\org.eclipse.jdt.core.prefs
文件 442 2010-11-26 23:32 s3h3\.settings\org.eclipse.wst.common.component
文件 323 2010-11-26 23:32 s3h3\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2010-11-26 23:32 s3h3\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2010-11-26 23:32 s3h3\.settings\org.eclipse.wst.jsdt.ui.superType.name
目录 0 2010-11-26 23:32 s3h3\.settings
文件 2579 2010-11-27 11:33 s3h3\build\classes\applicationContext.xm
文件 3411 2010-11-27 12:23 s3h3\build\classes\com\mvc\controller\StudentController.class
目录 0 2010-11-27 00:30 s3h3\build\classes\com\mvc\controller
文件 365 2010-11-27 00:25 s3h3\build\classes\com\mvc\dao\EntityDao.class
文件 1351 2010-11-27 00:25 s3h3\build\classes\com\mvc\dao\EntityDaoImpl$1.class
文件 1107 2010-11-27 00:25 s3h3\build\classes\com\mvc\dao\EntityDaoImpl$2.class
文件 1041 2010-11-27 00:25 s3h3\build\classes\com\mvc\dao\EntityDaoImpl$3.class
文件 1041 2010-11-27 00:25 s3h3\build\classes\com\mvc\dao\EntityDaoImpl$4.class
文件 1596 2010-11-27 00:25 s3h3\build\classes\com\mvc\dao\EntityDaoImpl.class
目录 0 2010-11-27 00:25 s3h3\build\classes\com\mvc\dao
文件 1452 2010-11-27 12:23 s3h3\build\classes\com\mvc\entity\Student.class
目录 0 2010-11-27 00:25 s3h3\build\classes\com\mvc\entity
文件 1644 2010-11-27 02:48 s3h3\build\classes\com\mvc\service\StudentService.class
目录 0 2010-11-27 01:07 s3h3\build\classes\com\mvc\service
目录 0 2010-11-27 00:25 s3h3\build\classes\com\mvc
目录 0 2010-11-27 00:25 s3h3\build\classes\com
文件 455 2010-11-26 01:02 s3h3\build\classes\hibernate.properties
文件 259 2010-11-27 01:03 s3h3\build\classes\log4j.properties
目录 0 2010-11-27 11:33 s3h3\build\classes
目录 0 2010-11-26 23:32 s3h3\build
文件 2579 2010-11-27 11:33 s3h3\src\applicationContext.xm
............此处省略71个文件信息
相关资源
- 简单的SSH框架的增删改查
- 基于全注解的ssh完整
- EasyUi框架,增删改查保证完整
- Spring mvc指南+Spring mvc入门
- Spring MVC+Mybatis整合实现用户登录以及
- 基于SSM框架开发的因酷开源网络课堂
- 基于 spring,spring mvc,mybatis 权限管理
- Spring mvc + Spring + Spring jdbc 整合
- 基于spring mvc、spring、hibernate、bootst
- ssm框架整合spring、spring mvc、mybatis开发
- 通用开发平台spring mvc + spring + bootst
- ssm分页增删改查
- SSM入门增删改查
- jsf1.2+spring3.0+hibernate3.3-单表增删改查
- 使用Servlet写的增删改查项目
- ssm框架登录增删改查
- idea整合ssm增删改查
- Spring MVC AOP通过注解方式拦截Controll
- VS+QT环境下读取excel文件到QT界面,并
- ssm_bbs项目 基本的增删改查
- springmvc注解实现用户注册验证
- 简单实现SSM增删改查
- springmvc+spring+hibernate实现简单的增删改
- android 获取远程服务器增删改查
- zw_springmvcmavencas单点登录全注解.zip
- Spring MVC框架的各种依赖包
- SSH三大框架整合 struts2+hibernate+spring
- webrtcDemo150521
- ssh框架源码 零配置 带注解
- SSH框架实现简单的用户管理系统增删
评论
共有 条评论