// Javado
cument
// Tomcat/web-inf/classes/login
package login;
import java.util.*;
public class logBean
{
private String username;
private String password;
private String email;
private Hashtable errors;//Hashtable declare
public logBean()
{
//------构造-----
username="";
password="";
email="";
errors=new Hashtable();
}
public String getUsername(){
return username;
}
public String getPassword(){
return password;
}
public String getEmail(){
return email;
}
public void SetUsername(String usernameStr){
username=usernameStr;
}
public void SetPassword(String passwordStr){
password=passwordStr;
}
public void SetEmail(String emailStr){
email=emailStr;
}
public void SetErrors(String key,String msg){
errors.put(key,msg);
}
public boolean validate(){
boolean allok=true;
if (username.equals(""
){
errors.put("username","username not null"
;
username="";
allok=false;
}
//-=---------
if (password.equals(""
) {
errors.put("password","please password"
;
password="";
allok=false;
}
if (email.equals(""
||(email.indexOf('@')==-1)||(email.indexOf('.')==-1)){
errors.put("email","email input error"
;
email="";
allok=false;
}
return allok;
}
//---------------
public String getErrorMsg(String s){
String errorMsg=(String)errors.get(s.trim());
return (errorMsg==null)?"":errorMsg;
//-------????------
}
}///end bean;