• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

servlet example without using MVC pattern

 
Greenhorn
Posts: 18
Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have written the following Servlet for Login Page without using MVC pattern:
Correct UserNames and Passwords are stored in MSAccess Database.



The problem is this ..when I enter wrong UserName and Password, it prints ‘Invalid UserName or Password’ many times.But I want it only once.How to overcome this problem.please help me to make correction in the code.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're selecting every name in the table and then comparing them in your Java code.
Why not build a select statement that looks for the exact username and password entered by the user.

If you have an empty resultSet, then you know there was no match.
reply
    Bookmark Topic Watch Topic
  • New Topic