struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Orme <to...@genome.med.harvard.edu>
Subject Re: Best Practices for Forms
Date Mon, 02 Mar 2009 20:58:37 GMT
Ok, this helps a lot. Simply from a usability standpoint though, the latter example seems more
in line with what I'd want. It seems silly to have to bring the user to a page where, in my
case, they 
would invariably click a link. I was aware of the TokenSession interceptor, and as you stated,
it does fix the issue, but I was more curious about the best practice.

Thanks,
Tim

hernan gonzalez wrote:
> 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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

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


Mime
View raw message