资源简介
全程手敲,亲测实用,适用于ssm框架初学者
代码实现增、删、改、查及登录注册全套
代码片段和文件信息
package com.springmvc.controller;
import com.springmvc.pojo.Admin;
import com.springmvc.service.AdminService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Controller
public class main {
@Autowired
private AdminService service;
// @RequestMapping(“/getUser“)
//// public String getUser(int id HttpServletRequest request Model model){
//// request.setAttribute(“user“service.getAdmin(id));
//// model.addAttribute(“user“service.getAdmin(id));
//// return “/editUser“;
//// }
@RequestMapping(“/add“)
public String addUser(Admin adminModel model){
System.out.println(“ok“);
service.insertAdmin(admin);
return “allUser“;
}
@RequestMapping(“/find“)
public String chaxun (HttpServletRequest request Model model){
System.out.println(“qian“);
List userList = service.finall();
System.out.println(userList.toString());
System.out.println(“hou“);
model.addAttribute(“userList“userList);
request.setAttribute(“userList“userList);
return “allUser“;
}
@RequestMapping(“/getUser“)
public String getUser(int idHttpServletRequest requestModel model){
request.setAttribute(“user“service.getAdmin(id));
model.addAttribute(“user“service.getAdmin(id));
return “editUser“;
}
@RequestMapping(“/updateUser“)
public String updateUser(Admin adminHttpServletRequest requestModel model){
if(service.update(admin)){
admin=service.getAdmin(admin.getId());
request.setAttribute(“admin“admin);
model.addAttribute(“admin“admin);
return “redirect:/find;“;
}else{
return “error“;
}
}
@RequestMapping(“/deleUser“)
public String deleted(int idHttpServletRequest requestModel model){
service.delete(id);
return “redirect:/find;“;
}
@RequestMapping(“/LoginUser“)
public String login(Admin adminModel model){
System.out.println(““+admin.getName()+“,,,,“+admin.getPassword());
Admin admin1=service.login(admin);
System.out.println(“我传值进去了“);
if(admin1!=null){
System.out.println(“我能判断“);
return “redirect:/find;“;
}else {
}
return “error“;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 277 2018-03-30 10:15 TestSSM\.idea\artifacts\SSMWork_war.xm
文件 8920 2018-03-30 10:15 TestSSM\.idea\artifacts\SSMWork_war_exploded.xm
文件 626 2018-03-30 10:15 TestSSM\.idea\compiler.xm
文件 38682 2018-04-17 13:43 TestSSM\.idea\dataSources\e8b1d11d-62b0-4eee-abc3-bcd61e04a5c7.xm
文件 812 2018-04-17 13:18 TestSSM\.idea\dataSources.local.xm
文件 885 2018-04-17 13:13 TestSSM\.idea\dataSources.xm
文件 351 2018-03-30 10:15 TestSSM\.idea\deployment.xm
文件 172 2018-03-30 10:15 TestSSM\.idea\encodings.xm
文件 502 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__aopalliance_aopalliance_1_0.xm
文件 492 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__cglib_cglib_nodep_2_1_3.xm
文件 524 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__commons_codec_commons_codec_1_9.xm
文件 604 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__commons_collections_commons_collections_3_2_1.xm
文件 527 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__commons_dbcp_commons_dbcp_1_2_2.xm
文件 593 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__commons_fileupload_commons_fileupload_1_3_1.xm
文件 491 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__commons_io_commons_io_2_4.xm
文件 513 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__commons_lang_commons_lang_2_6.xm
文件 546 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__commons_logging_commons_logging_1_2.xm
文件 513 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__commons_pool_commons_pool_1_3.xm
文件 502 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__com_alibaba_fastjson_1_1_41.xm
文件 632 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__com_fasterxm
文件 583 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__com_fasterxm
文件 611 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__com_fasterxm
文件 487 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__com_google_guava_guava_14_0.xm
文件 534 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__com_jayway_jsonpath_json_path_0_8_1.xm
文件 504 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__io_netty_netty_3_5_2_Final.xm
文件 566 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__javax_servlet_javax_servlet_api_3_0_1.xm
文件 498 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__javax_servlet_jsp_jsp_api_2_2.xm
文件 425 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__jstl_jstl_1_2.xm
文件 443 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__junit_junit_4_12.xm
文件 457 2018-04-17 10:05 TestSSM\.idea\libraries\Maven__log4j_log4j_1_2_17.xm
............此处省略248个文件信息
评论
共有 条评论