1、设计思路
(1)利用Struts2框架设计出一个登录页面的跳转,当用户名和密码都正确时,
跳到登录成功页面;否则,跳到登录失败页面,并在10秒钟内跳到登录界面;
(2)在Action中判断用户名和密码的正确性,并进行跳转;
(3)通过struts.xml文件进行配置。
2、设计步骤
(1)编写用户的用户名和密码的封装类
User.java:
/** * @Title:User.java * @Package:com.you.model * @Description:用户封装类 * @Author: 游海东 * @date: 2014年2月28日 下午10:23:56 * @Version V1.2.3 */ package com.you.model; import java.io.Serializable; /** * @类名:User * @描述:用户封装类 * @Author:游海东 * @date: 2014年2月28日 下午10:23:56 */ public class User implements Serializable { /** * @Fields:serialVersionUID * @Fields_Type:long * @Description:序列化 * @date:2014年2月28日 下午10:24:53 */ private static final long serialVersionUID = 1L; /** * 用户名 */ private String username; /** * 密码 */ private String password; /** * @Description:get方法 * @date:2014年2月28日 下午10:26:11 * @return the username */ public String getUsername() { return username; } /** * @Description:set方法 * @date:2014年2月28日 下午10:26:11 * @param username the username to set */ public void setUsername(String username) { this.username = username; } /** * @Description:get方法 * @date:2014年2月28日 下午10:26:11 * @return the password */ public String getPassword() { return password; } /** * @Description:set方法 * @date:2014年2月28日 下午10:26:11 * @param password the password to set */ public void setPassword(String password) { this.password = password; } }