P
pete
i am currently studying exceptions within jsp and having a problem
compiling a class.... i have hit the errata discussion boards but
nothing was posted about this, so hopefully i can get the answer
here....
the following is my code straight out of my book, but it doesn't
compile... the goal is to utilize a custom Exception class called
UserException that i defined:
#################################
package com.wrox.errors;
public class ImprovedUser extends Object implements
java.io.Serializable{
public ImprovedUser() {};
private String username;
private String password;
public void setUsername(String name){
username = name;
}
public String getUsername(){
return username;
}
public void setPassword(String pass){
password = pass;
}
public void validateUser() throws Exception, NullPointerException{
if(username==null){
throw new UserException("Must supply a username!",null);}
if(password==null){
throw new UserException("Must supply a password!",username);}
if(!(username.equals("Casey") && password.equals("Kochmer"))){
throw new UserException("Couldn't validate password!",username);}
}
}
#################################
here are the errors i am getting; 3 of the same kind:
#################################
C:\jakarta-tomcat-5.0.28\webapps\begjsp-ch09\WEB-INF\classes\com\wrox\errors>javac
ImprovedUser.java
ImprovedUser.java:23: cannot resolve symbol
symbol : class UserException
location: class com.wrox.errors.ImprovedUser
throw new UserException("Must supply a username!",null);}
^
ImprovedUser.java:25: cannot resolve symbol
symbol : class UserException
location: class com.wrox.errors.ImprovedUser
throw new UserException("Must supply a password!",username);}
^
ImprovedUser.java:27: cannot resolve symbol
symbol : class UserException
location: class com.wrox.errors.ImprovedUser
throw new UserException("Couldn't validate password!",username);}
^
3 errors
#################################
please note that UserException.class is in the same directory as
ImprovedUser.java and that is in the errors directory mentioned in the
package reference at the top of the ImprovedUser.java file
above............
any help will be appreciated....
Thanks!
Pete
compiling a class.... i have hit the errata discussion boards but
nothing was posted about this, so hopefully i can get the answer
here....
the following is my code straight out of my book, but it doesn't
compile... the goal is to utilize a custom Exception class called
UserException that i defined:
#################################
package com.wrox.errors;
public class ImprovedUser extends Object implements
java.io.Serializable{
public ImprovedUser() {};
private String username;
private String password;
public void setUsername(String name){
username = name;
}
public String getUsername(){
return username;
}
public void setPassword(String pass){
password = pass;
}
public void validateUser() throws Exception, NullPointerException{
if(username==null){
throw new UserException("Must supply a username!",null);}
if(password==null){
throw new UserException("Must supply a password!",username);}
if(!(username.equals("Casey") && password.equals("Kochmer"))){
throw new UserException("Couldn't validate password!",username);}
}
}
#################################
here are the errors i am getting; 3 of the same kind:
#################################
C:\jakarta-tomcat-5.0.28\webapps\begjsp-ch09\WEB-INF\classes\com\wrox\errors>javac
ImprovedUser.java
ImprovedUser.java:23: cannot resolve symbol
symbol : class UserException
location: class com.wrox.errors.ImprovedUser
throw new UserException("Must supply a username!",null);}
^
ImprovedUser.java:25: cannot resolve symbol
symbol : class UserException
location: class com.wrox.errors.ImprovedUser
throw new UserException("Must supply a password!",username);}
^
ImprovedUser.java:27: cannot resolve symbol
symbol : class UserException
location: class com.wrox.errors.ImprovedUser
throw new UserException("Couldn't validate password!",username);}
^
3 errors
#################################
please note that UserException.class is in the same directory as
ImprovedUser.java and that is in the errors directory mentioned in the
package reference at the top of the ImprovedUser.java file
above............
any help will be appreciated....
Thanks!
Pete