return false;
}
/*
note here we get the username from userinfo not userverify
if the username has been deleted before, the userverify entry will have been
deleted
but the userinfo entry is still there, hence we avoid "duplicate" usernames by
selecting from userinfo
*/
String sqlStmt = "select username from userinfo where username= " + username +
" ";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sqlStmt);
if (rs.next()) {
ResultSetMetaData rsmd = rs.getMetaData();
if (rsmd.getColumnCount() > 0) {
if (username.equals(rs.getString(1))) {
exists = true;
}
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return exists;
}
protected Hashtable validateData(HttpServletRequest req1) {
HttpServiceRequest req = (HttpServiceRequest) req1;
Hashtable errors = new Hashtable();
try {
String aString = req.getParameter("first_name");
if (aString == null || aString.equals("")) {
errors.put("first_name", "First name cannot be empty");
}
aString = req.getParameter("last_name");
if (aString == null || aString.equals("")) {
errors.put("last_name", "Last name cannot be empty");
}
aString = req.getParameter("email_address");
if (aString == null || aString.equals("")) {
errors.put("email_address", "Email address cannot be empty");
}
aString = req.getParameter("birth_date");
if (aString == null || aString.equals("")) {
errors.put("birth_date", "Birth Date cannot be empty");
}
aString = req.getParameter("address");
if (aString == null || aString.equals("")) {
errors.put("address", "Address cannot be empty");
}
} catch (Exception e) {
e.printStackTrace();
}
return errors;
}
private Hashtable validatePassword(String password, Hashtable errors) {
if (password == null || password.equals("")) {
errors.put("password", "Password cannot be empty");
return errors;
}
if (password.length()<4) {
errors.put("password", "Password must be 4 characters or longer");
return errors;
Appendix B. Java code relating to DB2
157




  

Home

About Services Network Support FAQ Order Contact
 

Linux Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved