Action为:
public class LoginAction extends ActionSupport{ private static final long serialVersionUID = 11231313131313L;
private String role;
private int id;
private Iteacharbiz iteacharbiz;
private String password;
private Istudentbiz istudentrbiz;
public String getRole() {
return role;}
public void setRole(String role) {
this.role = role;}
public int getId() {
return id;}
public void setId(int id) {
this.id = id;}
public void setIteacharbiz(Iteacharbiz iteacharbiz) {
this.iteacharbiz = iteacharbiz;
}
public String getPassword() {
return password;}
public void setPassword(String password) {
this.password = password;}
public void setIstudentrbiz(Istudentbiz istudentrbiz) {
this.istudentrbiz = istudentrbiz;}
@SuppressWarnings("unchecked")
public String login(){
if("student".equals(role)) {//如果以学生身份登录
if(istudentrbiz.allowLogin(id, password)) {
Student studentInfo = istudentrbiz.findByID(id);
//保存学生记录到session范围
Map session = ActionContext.getContext().getSession();
session.put("studentInfo", studentInfo);
return "studentSuccess";
}else {
addActionError("用户名或密码错误");
return INPUT;
}
}else {
if(iteacharbiz.findteacharByIDAndPassword(id, password) > 0) {
return "teacherSuccess";
}else {addActionError("用户名或密码错误");
                                                          return INPUT;
}
}
}
}
jsp重要代码页面为:
<form action="LoginAction.action" method="post">
    <table> 
    <tr><td colspan="2"><s:actionerror/></td></tr><!-- 显示错误信息 -->
    <tr>
    <td>编号:</td>
    <td><input type="text" name="id" /></td>
    </tr>
    <tr>
    <td>密码:</td>
    <td><input type="password" name="password" /></td>
    </tr>
     <tr>
    <td>请选择角色:</td>
    <td>
    <input type="radio" name="role" value="student" checked="checked"/>学生
    <input type="radio" name="role" value="teachar" />教师
    </td>
    </tr> 
    <tr>
    <td><input type="submit" value="提交" /></td>
    <td><input type="reset" value="重置" /></td>
    </tr>
    </table>
   </form>症状:
我先按正确的编号密码,可以登陆到指定的界面去,于是我第二次故意打错编号和密码,这时在jsp页面指定的页面显示错误信息,这两部都没有问题,但是我再次输入正确的编号和密码时,页面就老是显示第二次登录时显示错误信息的状态,你在怎么输入正确的编号密码都进不去了,永远都现实出错的状态,哪位大侠知道这错在哪儿!
我唯一的方法只有重新部署后,才能正确登录,然后在次故意输入错误编号密码时,又和上面的情况一样,怎么办呀!!