我对java完全陌生。我有JSP登录页面。现在我想在JAVA CLASS中验证用户名和密码(硬编码)而不是servelet等。如何通过jsp做到这一点我的代码:
package FileIO;
public class Login_Authentication {
String username;
String password;
public String execute()
{
if(this.username.equals("buyer")
&& this.password.equals("buyPW"))
{
return "1";
}else
{
return "-1";
}
}
public String getUsername()
{ return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getPassword()
{ return password;
}
public void setPassword(String password)
{this.password = password;
}
}