• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Form Based Authentication

 
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a login page with username and password fields whenever user enters wrong password i want to display an alert message, when i use form based authentication on error it goes to fail_login.html but i dont want that action to take place i want an alert and along with that it should display the index.html again.Can anybody suggest me how to do this .

[code]

<form-login-page>/index.html</form-login-page>
<form-error-page>/fail_login.html</form-error-page>
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

then, you can validate in servlet itself. why you want to go form based authentication?
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah for that i did write a servlet, but my servlet is redirecting back to the login.html page, its not giving me the alert.

[code]
if(username.equals(loginname) && password.equals(pword))
{
session.setAttribute("UserName",username); response.sendRedirect("src/jsp/second.jsp");
}
else
{
response.sendRedirect("login.html");

}

here in else i can either give alert or redirect back to login.html but how do i get both, any suggestions please.
[ September 24, 2008: Message edited by: ruquia tabassum ]
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by ruquia tabassum:

here in else i can either give alert or redirect back to login.html but how do i get both, any suggestions please.



Alert , you means a JavaScript alert . If thats your need then How come a response from servlet execute those Client side javascript alert !

May be you can simply show a line of text with error message stating "Invalid User Name OR Password !" , for that , your Login Action Servlet looks like this ,



and on jsp page ,


I hope that's solve your problem . Now still you want that alert to be shown on wrong user id and password , then I suggest go for AJAX !


 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sagar Rohankar:



jsp page ,




you have to give !=
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I miss that , anyways, Thanks seetharaman
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you are welcome sagar
reply
    Bookmark Topic Watch Topic
  • New Topic