Protected form taglib ver. 1.3

    Custom JSP taglib. This taglib lets you protect HTML form submission. It is a common problem for web application: what you have to do if some form will be submitted more than once. Taglib lets you to assign for any HTML form some unique key. This key will be saved in session also. When such form is submitted, taglib lets you check such key against the number in the session. If they match, the form submission is valid and session based flag will be removed. If the user tries to submit the same form by using browser's "Back" button, the form's key no longer has a match in the session and taglib lets you detect this case.

You have to use this taglib with Forms taglib. Tag protectSubmission should be used within an appropriate form tag. For example:
 


<%@ taglib uri="formtag.tld" prefix="html" %>
<%@ taglib uri="taglib.tld" prefix="do" %>

<html:form name="form1" action="proceed.jsp" method="post">
   ...
   <do:protectSubmission/>
   ...
</html:form>

in file proceed.jsp you may have some like this:
 


<%@ taglib uri="taglib.tld" prefix="do" %>

<do:validSubmission name="form1">

   ... proceed your form

</do:validSubmission>

or
 

<%@ taglib uri="taglib.tld" prefix="do" %>

<do:notValidSubmission name="form1">

   ... output error message or just ignore submission

</do:notValidSubmission>

Tags are:

protectSubmission

Marks form in order to prevent multiple submissions. Parameters are: none

validSubmission

Body tag. Executes own body if submission is valid

1) name Optional parameter. Describes form's name.

notValidSubmission

Body tag. Executes own body if submission is not valid

1) name Optional parameter. Describes form's name.

for downloading:

Library: pformtag.jar    Description: taglib.tld

© Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.