Two Laptop Bag
The moose likes JSP and the fly likes validate username and password Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "validate username and password" Watch "validate username and password" New topic

validate username and password

pradip thite

Joined: Apr 19, 2014
Posts: 9
hello, friends, i want to validate username and password in javascript...i want to validate username and password with database values..if login failed i want to display alert message...ok..but problem is that i have index.jsp page...after clicking login button control goes to homepage.jsp..okk.. in index.jsp i have taken dropdown to show designation...i select desgn then control goes to repective homepage... in homepage i am checking uname and password with database values..
if login successful it goes to respective pages...but if login failed it has to show me alert message...
how can i do that ?? please help me friends...
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32649

You wouldn't be validating the password in the browser via JavaScript. You need to validate the password on the server side.

A common way of dealing with this is to redirect to a different page based on the success/failure of validation. What happens now when you click on the login button? Hopefully it goes to a servlet that can perform this logic.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: validate username and password
It's not a secret anymore!