JSP Processing Method for repeated form submission, jsp form
This example describes how to use JSP to submit multiple forms. We will share this with you for your reference. The details are as follows:
1. Execute the following when generating the form:
Copy codeThe Code is as follows: session. setAttribute ("forum_add", "forum_add ");
2. Make the following judgment when submitting the Processing
If (isRedo (request, "forum_add") {// The system prompts repeated submission for related processing}
Related functions:
/*** Determine whether the request is submitted repeatedly ** 1. Check whether the Session contains the attribute of the specified name * 2. If the Session does not contain this attribute or the attribute is empty, it indicates that it has been processed and is regarded as repeated submission * 3. Otherwise, it indicates that it is the first processing and the attribute is deleted 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.