正在回答 回答被采纳积分+1
访问路径localhost:8088/department/to_add,跳转到了to_login。
DepartmentController:
package com.imooc.oa.controller;
import com.imooc.oa.biz.DepartmentBiz;
import com.imooc.oa.entity.Department;
import com.imooc.oa.entity.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.Map;
@Controller("departmentController")
@RequestMapping("/department")
public class DepartmentController {
@Autowired
private DepartmentBiz departmentBiz;
@RequestMapping("/list")
public String list(Map<String,Object> map){
map.put("list",departmentBiz.getAll());
return "department_list";
}
@RequestMapping("/to_add")
public String toAdd(Map<String,Object> map){
map.put("department",new Department());
return "department_add";
}
@RequestMapping("/add")
public String add(Department department){
departmentBiz.add(department);
return "redirect:list";
}
@RequestMapping(value = "/to_update",params = "sn")
public String toUpdate(String sn,Map<String,Object> map){
map.put("department",departmentBiz.get(sn));
return "department_update";
}
@RequestMapping("/update")
public String update(Department department){
departmentBiz.edit(department);
return "redirect:list";
}
@RequestMapping(value = "/remove",params = "sn")
public String remove(String sn){
departmentBiz.remove(sn);
return "redirect:list";
}
}
- 参与学习 人
- 提交作业 205 份
- 解答问题 4317 个
Java中非常实用的SSM整合开发内容,从Spring开始,到MyBaits的进阶内容,再到SpringMVC的应用,最后是SSM整合开发案例,逐步深入,助你成长为一名Java工程师!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星