资源简介
ssm通讯录
代码片段和文件信息
package com.ssm.controller;
import java.util.linkedHashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;
import com.ssm.domain.Contact;
import com.ssm.domain.User;
import com.ssm.service.ContactService;
@Controller
@Scope(value=“prototype“)
@RequestMapping(“/contact“)
public class ContactController {
@Resource
private ContactService contactService;
/*@RequestMapping(value=“/getAll“)
public String getAll(Model model) throws Exception{
List contacts=contactService.getAll();
model.addAttribute(“contacts“ contacts);
return “getAll“;
}*/
//查询用户的全部记录
@RequestMapping(value=“/getAll“)
public String getAll(HttpSession sessionint id)throws Exception{
List contacts =contactService.getAll(id);
session.setAttribute(“contacts“ contacts);
return “getAll“;
}
//根据ID删除单条记录
@RequestMapping(value=“/deleteById“)
public ModelAndView deleteById(ModelAndView modelInteger t_idint id){
contactService.deleteById(t_id);
model.setView(new RedirectView(“/newssm/contact/getAll.action?id=“+id));
return model;
}
//修改记录信息
@RequestMapping(“/toUpdate“)
public String toUpdate(int t_idModel model){
Contact contact=contactService.getAllById(t_id);
model.addAttribute(“contact“ contact);
return “contact_update“;
}
@RequestMapping(value=“/doUpdate“)
public ModelAndView updateById(ModelAndView modelContact contact){
contactService.update(contact);
int lalala=contact.getUser_id();
model.setView(new RedirectView(“/newssm/contact/getAll.action?id=“+lalala));
return model;
}
/*@RequestMapping(value=“/doUpdate“)
public ModelAndView updateById(ModelAndView modelContact contact){
contact.setT_age(11);
contact.setT_name(“李锦记“);
contactService.update(contact);
//System.out.println(contact.getT_address());
int lalala=contact.getUser_id();
model.setView(new RedirectView(“/newssm/contact/getAll.action?id=“+lalala));
return model;
}*/
//增加单条通讯录记录
@RequestMapping(“/toSave“)
public String toSave(int user_idHttpSession session){
session.setAttribute(“user_id“ user_id);
return “contact_save“;
}
@RequestMapping(value=“/save“)
public ModelAndView save(ModelAndView modelContact contact){
contactService.save(contact);
int lalala=contact.getUser_id();
model.setView(new RedirectView(“/newssm/contact/getAll.action?id=“+lalala));
return model;
}
//动态查询
@RequestMapping(“/dynamicSelect“)
public ModelAndView dynamicSelect(Contact contact
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-06-08 15:40 newssm1\
目录 0 2017-06-09 11:56 newssm1\newssm\
文件 3581 2017-06-06 13:16 newssm1\newssm\.classpath
文件 1048 2017-06-06 13:17 newssm1\newssm\.project
目录 0 2017-06-08 15:40 newssm1\newssm\.settings\
文件 567 2016-09-29 09:12 newssm1\newssm\.settings\.jsdtscope
文件 76 2017-06-06 13:16 newssm1\newssm\.settings\com.genuitec.eclipse.migration.prefs
文件 364 2017-06-06 13:16 newssm1\newssm\.settings\org.eclipse.jdt.core.prefs
文件 470 2016-09-29 09:12 newssm1\newssm\.settings\org.eclipse.wst.common.component
文件 345 2017-06-06 13:16 newssm1\newssm\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2016-09-29 09:12 newssm1\newssm\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2016-09-29 09:12 newssm1\newssm\.settings\org.eclipse.wst.jsdt.ui.superType.name
目录 0 2017-06-08 15:40 newssm1\newssm\WebContent\
目录 0 2017-06-08 15:40 newssm1\newssm\WebContent\me
文件 39 2016-09-29 09:12 newssm1\newssm\WebContent\me
目录 0 2017-06-08 15:40 newssm1\newssm\WebContent\WEB-INF\
目录 0 2017-06-08 15:40 newssm1\newssm\WebContent\WEB-INF\lib\
文件 4467 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\aopalliance-1.0.jar
文件 610790 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\c3p0-0.9.1.2.jar
文件 121757 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\commons-dbcp.jar
文件 261809 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\commons-lang-2.4.jar
文件 60686 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\commons-logging-1.1.1.jar
文件 62103 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\commons-pool.jar
文件 228286 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\jackson-core-asl-1.9.2.jar
文件 765648 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\jackson-mapper-asl-1.9.2.jar
文件 414240 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\jstl-1.2.jar
文件 481535 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\log4j-1.2.16.jar
文件 651643 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\mybatis-3.1.1.jar
文件 41167 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\mybatis-spring-1.1.1.jar
文件 832960 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\mysql-connector-java-5.1.22-bin.jar
文件 321428 2013-04-26 22:21 newssm1\newssm\WebContent\WEB-INF\lib\org.springfr
............此处省略86个文件信息
- 上一篇:产品经理常用文档+
- 下一篇:12V电子锁控制电路
评论
共有 条评论