views:

209

answers:

2

How can I do the username and password authentication(the username and the password is stored in the database then contact with the database to validate if the username and the password is valid or not. If the username and the password is valid then show the next page otherwise show the same login page with error message)

A: 

By coincidence I posted similar answer some minutes ago. As I am not going to copypaste or retype, here's a link: http://stackoverflow.com/questions/1945377/authenticating-the-username-password-by-using-filters-in-java-contacting-with-d/1946121#1946121

Hope this helps.

BalusC
A: 

take a look at filters in servlets, google for them and you will get some examples where a filter is used for authentication.

Regards.

Omar Al Kababji