At 3:03 PM +0100 12/5/05, Nicolas De Loof wrote:
Hello,

I'm using token to avoid multiple submits in this flow :

"/commande.do" creates an empty form-bean, saves a token and forwards to "tile:commande.new"
"/commande/create.do" checks for token and creates datas in the database.

If an exception occurs, an exceptionHandler is used to display an error message. I'm using it to catch Data integrity exception when user try to create an allready-existing entry. In this case, no token is saved anymore and user cannot change it's input and resubmit.

How can I setup struts to have a new token beeing saved when an exception occurs, to allow the user to correct the form and submit ?

The easiest thing I can think of would be to drop the declarative exception handling; catch the exception in the action mapped to /commande/create.do instead, where you can save a new token and return the user to "tile:commande.new".

Of course, you could extend the base ExceptionHandler, perhaps adding a configuration element that tells it to reset the token when the config is in a certain state. In Struts 1.2 you can extend ExceptionConfig and add arbitrary bean properties like you might with ActionMapping, and in Struts 1.3 ExceptionConfig participates in the arbitrary property-map model so that you don't even need to extend it. But I think that may be too much behavior for an exception handler. I am not inclined to use exceptions to route control flow.

Joe



Nico.


This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to