method one:
jsp in:
<c: IF the Test = "$ {param.message == '1'}">
<Script>
Alert ( '! donations success, thank you for your support and wish you a healthy and happy');
</ Script>
</ c: if>
<C: = IF Test "$ {param.message == '0'}">
<Script>
Alert ( 'system failure, the operation fails, add again!');
the window.location = 'addView.jsp';
< / Script>
</ C: IF>
in action:
IF (OK) {
Response.sendRedirect ( "Message showLoveInHeartWeb. 1 =?"); // equal success. 1
} the else {
; Response.sendRedirect // 0 for failure ( "Message showLoveInHeartWeb = 0?")
}
Method two:
JSP in :
<script>
function check() {
var formname = document.form1;
if (formname.lname.value != "") {
alert("添加成功");
return true;
}
if (formname.lname.value == "") {
alert("姓名不能为空!");
formname.lname.focus();
return false;
}
}
</script>
<form action="addLoveInHeartWeb" method="post" onSubmit="return check(this)" name="form1">
<table border="1">
<tr><td><input type="text" name="lname"></td></tr>
<tr><td><input type="submit" value="提交"></td></tr>
</table>
</form>
---恢复内容结束---
---恢复内容结束---