The examples in this article describe how JSP handles recurring forms for form submissions. Share to everyone for your reference, specific as follows:
1. When you generate the form, you do the following:
Copy Code code as follows:
Session.setattribute ("Forum_add", "Forum_add");
2. When submitting the processing, make the following judgment
if (Isredo (Request, "Forum_add")) {
//prompt for repeated submissions, for related processing
}
Related functions:
/**
* To determine if the repeat submission
* 1, check whether the session contains the specified name of the property
* 2, if the session does not have the attribute or the attribute is empty, the proof has been processed, to judge the duplicate submission
* 3, otherwise, The proof is first processed and the attribute is removed from the session.
* @param key String
*
/private Boolean Isredo (HttpServletRequest request, string key) {
string Value = (String) request.getsession (). getattribute (key);
if (value = = null) {return
true;
}
else {
request.getsession (). removeattribute (key);
return false;
}
}
I hope this article will help you with JSP program design.