Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3611390
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:52:13+00:00 2026-05-18T21:52:13+00:00

What I got so far: It all begins with an HTML form which prompts

  • 0

What I got so far:
It all begins with an HTML form which prompts the user for a username and password. From there it post the acquired user/pass to a servlet, GateKeeper. GateKeeper determines if the user/pass combination match any records in the MySQL database.
Here is the sql I use: SELECT id FROM Users WHERE username='?' AND password=MD5('?') where the ? indicate information provided the previous HTML form.

What I need now:
I need some way to store the username and id of the record in the database. GateKeeper redirects the user to a control panel upon success. Therefore, I need a method to reference the username to display simple greetings, etc and also the id so it eliminates unnecessary calls to the database. The control panel may make AJAX calls to Servlets that preform some sort of task to the MySQL database.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:52:14+00:00Added an answer on May 18, 2026 at 9:52 pm

    Just store the logged-in user in the session.

    User user = userDAO.find(username, password);
    if (user != null) {
        request.getSession().setAttribute("user", user);
        // Display home page.
    } else {
        // Display login form with error message.
    }
    

    It’s then just available by ${user} in JSP EL.

    <p>Welcome back, <c:out value="${user.fullname}" /></p>
    

    Another advantage is that you can just check the presence of the logged-in user in the session to block/allow access to certain pages with help of a Filter.

    Related questions:

    • Authenticating the user by filters
    • Persistent data in webapp session

    By the way, your preparedstatement SQL is syntactically invalid. It should be without singlequotes.

    SELECT id FROM Users WHERE username=? AND password=MD5(?)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got this far: :~ curl -u username:password -d status=new_status http://twitter.com/statuses/update.xml Now, how can
So far i have got the code below which works lovely when trying an
I post this previously in Adobe Forum but haven't got any answers so far.
This is what I got so far, and it's not working at all :(
All ive got so far are the definitions. double power(double base, int exponent); double
Here's what I've got so far. srm , sre , srd are all jQuery
I have got as far as getting the HTML response into a variable and
All, I'm trying to resolve some performance problems and I've got as far as
Here's what I got so far (that doesn't work). At this point I thought
Here is what I got so far. Please read the comment in the code.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.