首页>代码>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"; } }

xfcxzks
5小时前
暂无贡献等级
yangyuer LV1
2024年4月26日
kkkaaaa LV3
2023年5月18日
wanglinddad LV55
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日

xfcxzks
昨天
暂无贡献等级
微信网友_7187750786453504
2024年9月29日
暂无贡献等级
唐唐丶 LV34
2024年9月12日
krispeng LV14
2024年8月12日
李朝磊 LV18
2024年6月28日
yunsgui LV1
2024年6月25日
happySuperman LV2
2024年6月4日
李俊雄 LV3
2024年5月8日
educationAAA LV11
2024年5月2日
yangyuer LV1
2024年4月26日