title: Displaying a users first name on Welcome page through a servlet JDBC
body: <p>I have the working code here to pull all info that I need from my users and user info table located in an oracle database :</p>
  
  <pre><code>try
          {
              conn = DB_Admin.getConnection();
              pstmnt = conn.prepareStatement("SELECT u.username, u.password, ui.user_id, " +
                                              "ui.f_name, ui.l_name, ui.email, ui.dob FROM users u " +
                                              "JOIN user_info ui ON ui.user_id = u.user_id " +
                                              "WHERE u.username = ? AND u.password = ?");
              pstmnt.setString(1, username);
              pstmnt.setString(2, password);
              rs = pstmnt.executeQuery();
              boolean exists = rs.next();
  
                      ...
  </code></pre>
  
  <p>And I have a servlet which is I am trying to make display the users first name after he/she logs in:</p>
  
  <pre><code>String username = request.getParameter("username").toString();
          String password = request.getParameter("password").toString();
  
          User user1 = new User(username, password);
          User user2 = new User(username,password, user1.getF_name(), user1.getL_name(), user1.getEmail(), user1.getDob());
  
          //HttpSession session = request.getSession();
          //session.setAttribute("f_name", user1.getF_name());
  
          boolean valid = ud.login(username, password);
          try{
              if(!valid)
              {
              //  request.setAttribute("var", companies);
                  response.sendRedirect("login.html");
                  logger.warn("Login Servlet : " + username + " has failed at logging in");
              }
              else
              {
                  //response.sendRedirect("index.jsp");
                  request.setAttribute("f_name",user2.getF_name());
                  RequestDispatcher rd = request.getRequestDispatcher("index.jsp");
                  rd.forward(request, response);
                  logger.info("Login Servlet : " + username + " has logged in");
              }
          }
          catch (Exception ex) { out.println(ex.getMessage()); } 
  </code></pre>
  
  <p>In my User class I have getters and setters for all fields: "f_name, email, etc."</p>
  
  <p>I know this code is written incorrectly, and I keep getting a "null" value on my welcome page.</p>