Am new to JSP and Servlets so please bear with me for my simple question
I have designed a login page (Login.jsp) which validates the credentials entered by the user in the database and if the credentials matches, then am displaying a new jsp (loginsuccess.jsp).
However, when the user enters wrong credentials am redirecting to the Login.jsp and am displaying the error message "Please check your username or password). But this message is displayed after the Submit button in the login page.
Now, i want this error message to be displayed just before the Submit button and after the Password field (example: as it is done in the Gmail login page)
Currently am using the following code to display the error message
<%
String error=request.getParameter("error");
if(error==null || error=="null"){
error="";
}
%>
the parameter "error" will be set in the loginsevlet upon validation.
But this message is currently displaying after the Submit button. Am displaying the Login fields (username, password and submit button) using a table as separate rows. With the current design (table) will it be possible to insert dynamically the error message as a new table row before the Submit button table row ?
Any pointers is much appreciated