• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can anyone tell me how to make a authentication with jsp & servlet

 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can anyone tell me how to make a authentication with jsp & servlet ?
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cookies.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic