1.登录并在登录页面显示用户信息
1.在DAO层UserDao中添加登录函数
//登录
UserInfo doLogin(String username);
2.在mapper层中UserMapper.xml文件中添加登录标签
<select id="doLogin" resultType="com.zhongruan.bean.UserInfo" parameterType="java.lang.String">
select * from tb_user where username=#{username}
</select>
3.service层中在UserInfoService中添加该函数
//登录
UserInfo doLogin(String username);
4.service层中Impl中实现该函数
public UserInfo doLogin(String username) {
return userDao.doLogin(username);
}
5.controller层实现
@RequestMapping("/doLogin.do")
public String doLogin(String username, String password, HttpSession session){
UserInfo userInfo = userInfoService.doLogin(username);
if(userInfo!=null){
if(userInfo.getPassword().equals(password)){
System.out.p