File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form Based Authentication

 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • 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>
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
Sagar Rohankar
Ranch Hand
Posts: 2905
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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 Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sagar Rohankar:



jsp page ,




you have to give !=
 
Sagar Rohankar
Ranch Hand
Posts: 2905
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I miss that , anyways, Thanks seetharaman
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you are welcome sagar
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic