or maybe add that javascript to the extended commandLink/commandButton (through a new parameter) so that using the t:commandLink avoid the multiple submission problem by default?...

I'll have a go at doing this, perhaps with a configurable/optional timeout
since, as a user, I've been annoyed by sites that force you to reload the page if the first submit doesn't work.

I had a go at using the following JavaScript to prevent multiple submissions of the same page (I used MyFaces 1.1.1. See http://issues.apache.org/jira/browse/MYFACES-612 for the rest of the test case.):

<html>
    <head>
        <script>
            var formSubmitted=false;
        </script>
    </head>
    <body>
        <f:view>
            <h:form onsubmit="var proceed=!formSubmitted; formSubmitted=true; return 
proceed;" >
                <p>
                    <h:commandButton value="Submit" />
                </p>
                <p>
                    <h:graphicImage value="image.png" />
                </p>
            </h:form>
        </f:view>
    </body>
</html>

...and still got IllegalStateException "Cannot forward after response has been committed" on doing rapid multiple clicks on the commandButton. Once, interestingly, I also got the error and blank response using just one click after a redeployment.

I also still get the same error with my "real" application with the above JavaScript in place.

Jeremy

Reply via email to