Ok, got the silly errors out of the way, and I am back to the issue that brought me here originally. It was a problem with my web.xml file. This is the correct one, in case anyone is trying this on their own. I was basically missing the package name in the class definition (oops... silly me
<?xml version="1.0" encoding="UTF-8"?>
Now, when I run the program, it seems to do its thing, but it tells me i do not exist in the db, even when I do. Its definitely passing the info into the right classes, etc, because in my console in Eclipse I am getting this output:
Your user name is eternal_sage
Your password is Pass1234
Query: select * from users where username='eternal_sage' AND password='Pass1234';
Log In failed: An Exception has occurred! java.lang.NullPointerException
which is consistent with the error checking in the UserDAO class. I know the statement generated by the code works, as I've copied it verbatim into psql in the terminal and it gets exactly the result I'm looking for. What I am not understanding is the class not found exception. What does this mean? Am I missing some include or a lib or something? I am not sure I understand this statement in the source code either (its copied from a tutorial, not my own). What purpose does it serve? Is it just error checking? More digging, I suppose.
Oh, and sorry for posting and editing so much. I guess this thread is the equivalent of me thinking out loud so far. If this is somehow disrespectful, please just delete the thread. I just can't wait until someone answers to keep hacking at this thing, and as I am figuring out my screw ups it seems important to keep the thread updated so if someone does try to help me they have full info. I know you guys are busy, don't misunderstand. Its just that I have the time to work on this today, and may not for a while. Besides, I learn better when I figure it out on my own
sometimes I just need a nudge in the right direction.
--- Update ---
Ok. Seems that the tutorial I was following was using the ODBC to try and connect to the DB, which from my understanding, is a terrible, outdated, and not cross-platform compatible method of doing things. So I replaced all that code with the code I used in my DB program that I know works (using the JDBC postgres driver) and registered the silly thing in the classpath (oops) and viola, I'm to a whole new error
. Looking at my console, it seems that I have actually accessed the db now, it seems to be an issue with the UserLogged.jsp which is the destination page when the db access is successful. This error seems to have something to do with the UserBean class, or at least how it is being used in this case.
<%@ page language="java"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<title> User Logged Successfully </title>
<% UserBean currentUser = (UserBean(session.getAttribute("currentSessionUser")));%>
Welcome <%= currentUser.getFirstName() + " " + currentUser.getLastName() %>
The error is pointing at the line UserBean currentUser = (UserBean(session.getAttribute("currentSessionUser ")));
which looks alittle weird to me as well, although I'm not sure exactly what its doing, so I'm going to keep digging.
Edit: N/M I realized I needed to cast the UserBean. The code should have looked like this: <% UserBean currentUser = ((UserBean) (session.getAttribute("currentSessionUser")));%>
Which means that I am up and running completely! WOOT! I'll mark this as solved then. Sorry for all the trouble. Maybe my ramblings will help someone else, though.