CRM综合练习第二天
1. CRM用户模块之登录功能
1.1. 编写页面
action=\${pageContext.request.contextPath}/user/user_login.action\ method=\>
src=\${pageContext.request.contextPath}/images/login_1.gif\ border=0>
background=\${pageContext.request.contextPath}/images/login_2.jpg\ height=300> .
id=RequiredFieldValidator3 style=\FONT-WEIGHT: bold; VISIBILITY: hidden; COLOR: white\>请输入登录名
style=\HEIGHT: 28px\>
id=RequiredFieldValidator4 style=\FONT-WEIGHT: bold; VISIBILITY: hidden; COLOR: white\>请输入密码
1.2. 配置Action
/index.jsp
/login.jsp
1.3. 编写Action
public String login(){
SysUser u = userService.login(user); if(u != null){ //登录成功
return SUCCESS; }else{
//登录失败
//准备登录失败的信息
this.addActionError(\登录名或密码错误\); return LOGIN; } }
1.4. 编写Service
? Service接口
public interface UserService {
public void saveUser(SysUser user);
public SysUser login(SysUser user); }
? Service实现
/**
* 用户登录 */
@Override
public SysUser login(SysUser user) { return userDao.login(user); }
1.5. 编写DAO
? DAO接口
public interface UserDao {
public void save(SysUser user);