struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hernan gonzalez <>
Subject Re: Best Practices for Forms
Date Mon, 02 Mar 2009 20:24:50 GMT
To avoid the problem of duplicated submissions (not only when
refreshing the result page, but also when double clicking the submit
button, or going back to the submited form and submitting again) you
should take a look at  the TokenSessionStoreInterceptor.

But that is complementary with the other issue: it is not bad practice
to separate the actions "addData " from the action "viewData", the
later is idempotent , the former is not. Hence, you might implement
two separate Actions (or a same Action with two methods that return
different results). For example

<action name="SubmitData" class="action.SubmitDataAction">
        <result name="success">/viewSubmitResult.jsp</result>

<action name="ViewData" class="action.ViewDataAction">
        <result name="success">/viewData.jsp</result>

(Here SubmitDataAction should include the Token interceptor to avoid
double submissions. And /viewSubmitResult.jsp might just show a
generic succes message with a link to the ViewDataAction action)



<action name="SubmitData" class="action.SubmitDataAction">
        <result name="success"

<action name="ViewData" class="action.ViewDataAction">
        <result name="success">/viewData.jsp</result>

(This is a little more straightforward, but has the slight
disadvantage of losing any ActionMessage you might have produced in
the SubmitDataAction)


Hernán J. González

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message