can anyone tell me how to make a authentication with jsp & servlet
Samanthi perera
Ranch Hand
Joined: Jan 08, 2010
Posts: 510
posted
0
can anyone tell me how to make a authentication with jsp & servlet ?
Samanthi perera
Ranch Hand
Joined: Jan 08, 2010
Posts: 510
posted
0
this is my index.jsp
this is my servlet
it is working properly.
no problem.
1)if someone enter wrong password or username it is redirected to the index.jsp.
I need to add something if he enter incorrect password to the jsp
how to do this?
2) i need to add this to session tracking tooooo?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
You don't need to do anything with sessions in your code. The "How do I implement security for my web application ?" section in the ServletsFaq should get you started.
I mean if user login first time and didn't logout.
then next time he try to come this site he don't need to provide username or password.
how to impliment this feature?
Personally I feel this should be handled in a filter, not a servlet--at least the checking for login status--not the login itself.
Samanthi perera
Ranch Hand
Joined: Jan 08, 2010
Posts: 510
posted
0
can you give me exmple for cokkies how to set cokkies to this ?
why do you think that is handle in filter?
when you are talking about filter i feel it shuold better handle in listner?is it?
Samanthi perera wrote:can you give me exmple for cokkies how to set cokkies to this ?
Search the web--there are hundreds of examples.
why do you think that is handle in filter?
Because you need to check for login on a specific set of pages, and filters are good at that.
when you are talking about filter i feel it shuold better handle in listner?is it?
Depends on what specific aspect of the problem you're talking about. But no, I wouldn't use a listener for any of this, because the checking for logged in status and logging in are triggered by hitting a URL (handled by filters) and hitting the login URL (handled by servlets).