ssm的搭建见上一章
1.数据协议层
public User selectByLoginnameAndPassword(@Param("loginname")String loginname,@Param("password") String password);
2.服务协议层
User login(String loginname,String password);
3.服务层
@Autowiredprivate UserDao userDao;public User login(String loginname, String password) { return userDao.selectByLoginnameAndPassword(loginname, password); }
4.数据实现层(mybatis)
5.控制层
@Controllerpublic class UserController { @Autowired private UserService userServcie; @RequestMapping("/checklogin") @ResponseBody public User checklogin( String loginname,String paasword,HttpSession session){ System.out.println(loginname); User user =userServcie.login(loginname, paasword); if(user!=null) { session.setAttribute("user_session", user); return user; }else { return null; } }
后台搭建结束
6.前台搭建
ajax异步登陆