aspose file tools
The moose likes Servlets and the fly likes servlet example without using MVC pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "servlet example without using MVC pattern" Watch "servlet example without using MVC pattern" New topic
Author

servlet example without using MVC pattern

Shanu Pandey
Greenhorn

Joined: Mar 17, 2011
Posts: 18

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.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: servlet example without using MVC pattern
 
Similar Threads
user authentication servlet problem
DataSource issues
from servlet i want to use Ms Access
Help with this code!
How to separate Business Logic from the servlet