This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "validate username and password" Watch "validate username and password" New topic
Author

validate username and password

pradip thite
Greenhorn

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
Marshal

Joined: May 26, 2003
Posts: 30795
    
157

Pradip,
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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
 
subject: validate username and password