I am doing Login page---in that if Authentication is failed,
I want the to give some message to user that he is failed to login & login once again
for this purpose i want message window in servlet/java.
Rupa Katkar wrote: i want message window in servlet/java.
you should not display this message[authentication fail message] on servlet ,it consider poor practice . validate on servlet[using java class] set the message in request scope[any one of the scope] and forward it to the login page(jsp) and display it on jsp.
Rupa Katkar
Ranch Hand
Joined: Aug 12, 2009
Posts: 35
posted
0
seetharaman venkatasamy wrote:
Rupa Katkar wrote: i want message window in servlet/java.
you should not display this message[authentication fail message] on servlet ,it consider poor practice . validate on servlet[using java class] set the message in request scope[any one of the scope] and forward it to the login page(jsp) and display it on jsp.
I made the validation, but when user fails to give correct username/ password, we
should give some chance to reenter know, for this purpose i want the message window to display
that please re enter the details..
Rupa Katkar
Ranch Hand
Joined: Aug 12, 2009
Posts: 35
posted
0
Sagar Rohankar wrote:
Never tried this code, but give it a try .
I want to give more trials for re-entering the username / password,
For this purpose i want the message window.
So what's wrong with the code or suggestions you were given?
You can't do anything on the server side except return something to the client, like a message, a flag indicating a dialog should open, etc. I don't really think opening a window to simply display a failure message is appropriate--just show the message on the page.
What, specifically, are you having trouble with?
Rupa Katkar
Ranch Hand
Joined: Aug 12, 2009
Posts: 35
posted
0
David Newton wrote:So what's wrong with the code or suggestions you were given?
You can't do anything on the server side except return something to the client, like a message, a flag indicating a dialog should open, etc. I don't really think opening a window to simply display a failure message is appropriate--just show the message on the page.
What, specifically, are you having trouble with?
After showing the message using the window, I want it should again open the Login.jsp page.
I did like this
....
out.println("<script type=\"text/javascript\">");
out.println("alert(\"Please reenter the username/Password\")");
out.println("</script>");
RequestDispatcher dispatcher = request.getRequestDispatcher("/Login.jsp");
dispatcher.forward(request, response);
....
But what happening here, its not showing the alert, its directly going on Login.jsp page.
The thing is that i am new to jsp & all thats why i am facing so much problems..
Please help me.
I think you should back up a step and bring yourself up to speed on JSP and Java webapps in general, otherwise you're going to end up with a solution you don't understand, can't maintain, etc. Check out some of the tutorials on the Sun website and around the web.
Rupa Katkar wrote:
out.println("<script type=\"text/javascript\">");
out.println("alert(\"Please reenter the username/Password\")");
out.println("</script>");
To avoid writing HTML code in servlet we use JSP, so what you really need is incorporating this code in login.jsp which get displayed when some bean, flag is set, as I shown in my first reply.
And get your JSP basic clear first, Google for JSP/Servlets tutorials. :thumbup:
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.