首页>代码>Spring+Spring mvc + Mabatis 开发的oa办公系统实例>/fcoaSSM_RJ1/src/com/controller/employeeController.java
package com.controller; import java.io.UnsupportedEncodingException; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import com.Service.employeeService; import com.entity.Employee; @Controller @RequestMapping("emp") public class employeeController { @Autowired private employeeService empService; @RequestMapping("login") public String login(@ModelAttribute("e") Employee emp,HttpSession session) throws UnsupportedEncodingException{ //emp.setName(new String(emp.getName().getBytes("ISO-8859-1"),"utf-8")); emp = empService.findemp(emp); if (emp!=null) { session.setAttribute("emp", emp); return "index"; } else { return "login"; } } @RequestMapping("Remove") public String removeSession(HttpSession session){ session.invalidate(); return "login"; } @RequestMapping("register") public String register(@ModelAttribute("emp") Employee emp,HttpSession session) throws UnsupportedEncodingException{ emp.setName(new String(emp.getName().getBytes("ISO-8859-1"),"utf-8")); int i = empService.addemp(emp); session.setAttribute("sn", i); return "rgError"; } }
最近下载更多
kkkaaaa LV3
2023年5月18日
wanglinddad LV54
2022年2月24日
bin2337 LV4
2021年11月24日
1294800221 LV1
2021年8月30日
zhangx105888 LV1
2021年7月28日
01 LV1
2021年7月13日
457229171 LV7
2021年7月3日
xufei123 LV4
2021年6月2日
pengkui LV14
2021年5月3日
wangyan111111 LV8
2021年3月18日