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>

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

(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)

------------------------------------------------------------------------------------------------

or

<action name="SubmitData" class="action.SubmitDataAction">
        <result name="success"
type="redirect">ViewDataAction.do?id=%{dataId}</result>
</action>

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

(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
http://hjg.com.ar/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to