1. In the background action:
Request.setattribute ("message", "This user name or password is wrong, please re-enter!") ");
2, the front page JSP:
2.1. Add the OnLoad method to the <body> tag, for example: <body topmargin= "0" leftmargin= "0" onload= "checkform ()" >
2.2, add the JS code block in this JSP page, as follows:
<!--Popup Dialog: This user name or password is wrong, please enter it again! -
<script type= "Text/javascript" >
function Checkform () {
var flag = ' <%=request.getattribute ("message")%> ';
if (flag! = "Null") {
alert (flag);
/* Clear the values in the <input> tab
$ ("#name"). attr ("Value", "");
$ ("#password"). attr ("Value", "");
*/
}
}
</script>
Summary: The JS Code Pop-up dialog is executed through the research onload method in the foreground JSP by putting the error message into the message in the background.
Implement Java EE in the background action control foreground JavaScript Popup dialog box