Java web ssm框架登录时为什么po为空
程序代码:
controll @Controller public class SystemHandler { @Autowired private UserinfoService us; public UserinfoService getUs() { return us; } public void setUs(UserinfoService us) { this.us = us; } @RequestMapping(value="/login.action") public String login(LoginVO vo, HttpSession session) throws Exception{ UserinfoPO po=us.validateLogin(vo); if(po != null){ session.setAttribute("online", po); return "redirect:/main.jsp"; }else{ System.out.println("显示内容"); System.out.println(vo.getUname()); System.out.println(po); return "redirect:/index.jsp"; return "redirect:/main.jsp"; } } } service public interface UserinfoService { public UserinfoPO validateLogin(LoginVO vo) throws Exception; public List getDeptList(DeptListVO vo) throws Exception; public int getDeptListCount(DeptListVO vo) throws Exception; public DeptPO getDeptDetaiByID(int deptid) throws Exception; } service.impl @Service public class UserinfoServiceImpl implements UserinfoService{ @Autowired private UserInfoMapper mapper; public UserInfoMapper getMapper() { return mapper; } public void setMapper(UserInfoMapper mapper) { this.mapper = mapper; } @Override public UserinfoPO validateLogin(LoginVO vo) throws Exception { // TODO Auto-generated method stub System.out.println(vo.getUname()+'\n'+vo.getUpass()); return mapper.selectUserinfoByNameAndPass(vo); } @Override public List getDeptList(DeptListVO vo) throws Exception { // TODO Auto-generated method stub vo.setStart(PageUtil.getStartIndex(vo.getPagenum())); vo.setEnd(PageUtil.getEndIndex(vo.getPagenum())); return mapper.selectDeptList(vo); } @Override public DeptPO getDeptDetaiByID(int deptid) throws Exception { // TODO Auto-generated method stub return mapper.selectDeptDetailByID(deptid); } @Override public int getDeptListCount(DeptListVO vo) throws Exception { // TODO Auto-generated method stub return mapper.selectDeptListCount(vo); } } mapper ublic interface UserInfoMapper { public UserinfoPO selectUserinfoByNameAndPass(LoginVO vo) throws Exception; public int selectDeptListCount(DeptListVO vo) throws Exception; public List selectDeptList(DeptListVO vo) throws Exception; public DeptPO selectDeptDetailByID(int deptid) throws Exception; } po public class UserinfoPO { private String userid; private String username; private String userpass; private Date BIRTHDAY; private DeptPO dept; public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getUserpass() { return userpass; } public void setUserpass(String userpass) { this.userpass = userpass; } public Date getBIRTHDAY() { return BIRTHDAY; } public void setBIRTHDAY(Date bIRTHDAY) { BIRTHDAY = bIRTHDAY; } public DeptPO getDept() { return dept; } public void setDept(DeptPO dept) { this.dept = dept; } @Override public String toString() { return "UserinfoPO [userid=" + userid + ", username=" + username + ", userpass=" + userpass + ", BIRTHDAY=" + BIRTHDAY + ", dept=" + dept + "]"; } } vo public class LoginVO { private String uname; private String upass; public String getUname() { return uname; } public void setUname(String uname) { this.uname = uname; } public String getUpass() { return upass; } public void setUpass(String upass) { this.upass = upass; } } day789的主页
[此贴子已经被作者于2017-4-12 21:24编辑过]