beginJsp2.0外文书籍源代码
源代码在线查看: user2.java
package com.wrox.except;
import java.io.IOException;
public class User2
{
private String username;
private String password;
public User2()
{
}
public void setUsername(String username)
{
this.username = username;
}
public String getUsername()
{
return this.username;
}
public void setPassword(String password)
{
this.password = password;
}
public void validate() throws IOException, Exception
{
if(this.username == null || this.password == null)
{
IOException ioex = new IOException("You must supply a username"
+ " and password!!");
throw ioex;
}
if (!(this.username.equals("Casey")
&& this.password.equals("Kochmer")))
{
Exception trouble = new Exception("Couldn't validate your"
+ " password!");
throw trouble;
}
}
}