• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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

 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cookies.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic