You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Igor Shabalov <ig...@exadel.com> on 2003/03/29 00:42:23 UTC
Re: SUGGESTION: Transaction token creation control in struts-config.xml (LONG)
Good use case! I put it into attachment...
Best,
Igor.
On Fri, 28 Mar 2003 16:53:15 -0600, Steve Stair
<st...@rrc.state.tx.us> wrote:
> I've got a use case to edit an existing user.
> I've extended the ForwardAction class to make one that forwards after
> creating a transaction token.
>
> When the user clicks on a link to edit a user's data, they are first
> sent to an action that only
> loads the user data into the form. This action can be re-used by a
> View User use case,
> without any modification, because it doesn't create a transaction
> token.
> On success, that action forwards to the JSP page/tile via an action
> that creates a transaction token.
>
> When the user clicks save, the update action persists the data, and
> forwards to JSP again
> via the action that creates a transaction token.
>
> I've seen it said here that you shouldn't chain actions, but it seems
> more clear to me this way.
> By doing it this way, I don't have to create tokens in my code.
> The update action should not have to know that the place it is being
> forwarded to will need
> a transaction token. Isn't the point of defining forwards for an
> action that the java code
> doesn't care where it is going to next?
>
> <action-mappings>
> <!-- Action that only loads the user data -->
> <action
> path="/editUserAction"
> name="UserForm"
> type="com.whatever.LoadUserAction"
> validate="false"
> scope="request">
> <forward name="success" path="/editUser.do" />
> <forward name="failure" path="app.Home" />
> </action>
>
> <!-- Action that only creates a transaction token -->
> <action
> path="/editUser"
> type="com.whatever.TransactionForwardAction"
> parameter="app.EditUser"/>
>
> <!-- Action that persists the user data (consumes the transaction
> token) -->
> <action
> path="/updateUserAction"
> name="UserForm"
> type="com.whatever.UpdateUserAction"
> validate="true"
> input="app.EditUser"
> scope="request">
> <forward name="success" path="/editUser.do" />
> <forward name="cancel" path="app.Home" />
> <forward name="failure" path="/editUser.do" />
> </action>
>
> </action-mappings>
>
>
> In any case, in doing this, it seems to me that it would make sense if
> you could
> make an action create a transaction token by some entry in the
> struts-config.
>
>
>
> --
> Steve Stair
> Steve.Stair@rrc.state.tx.us
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
--
Igor Shabalov
Director of Engineering
Exadel Inc.
http://www.exadel.com
Fwd: Re: SUGGESTION: Transaction token creation control in struts-config.xml (LONG)
Posted by Igor Shabalov <ig...@exadel.com>.
Mailing list eats the attachments, sorry...
I just like this picture :-)
------- Forwarded message -------
From: Igor Shabalov <ig...@exadel.com>
To: Struts Users Mailing List <st...@jakarta.apache.org>
Subject: Re: SUGGESTION: Transaction token creation control in struts-
config.xml (LONG)
Date: Fri, 28 Mar 2003 15:42:23 -0800
>
> Good use case! I put it into attachment...
>
> Best,
> Igor.
>
>
> On Fri, 28 Mar 2003 16:53:15 -0600, Steve Stair
> <st...@rrc.state.tx.us> wrote:
>
>> I've got a use case to edit an existing user.
>> I've extended the ForwardAction class to make one that forwards after
>> creating a transaction token.
>>
>> When the user clicks on a link to edit a user's data, they are first
>> sent to an action that only
>> loads the user data into the form. This action can be re-used by a
>> View User use case,
>> without any modification, because it doesn't create a transaction
>> token.
>> On success, that action forwards to the JSP page/tile via an action
>> that creates a transaction token.
>>
>> When the user clicks save, the update action persists the data, and
>> forwards to JSP again
>> via the action that creates a transaction token.
>>
>> I've seen it said here that you shouldn't chain actions, but it seems
>> more clear to me this way.
>> By doing it this way, I don't have to create tokens in my code.
>> The update action should not have to know that the place it is being
>> forwarded to will need
>> a transaction token. Isn't the point of defining forwards for an
>> action that the java code
>> doesn't care where it is going to next?
>>
>> <action-mappings>
>> <!-- Action that only loads the user data -->
>> <action
>> path="/editUserAction"
>> name="UserForm"
>> type="com.whatever.LoadUserAction"
>> validate="false"
>> scope="request">
>> <forward name="success" path="/editUser.do" />
>> <forward name="failure" path="app.Home" />
>> </action>
>>
>> <!-- Action that only creates a transaction token -->
>> <action
>> path="/editUser"
>> type="com.whatever.TransactionForwardAction"
>> parameter="app.EditUser"/>
>>
>> <!-- Action that persists the user data (consumes the transaction
>> token) -->
>> <action
>> path="/updateUserAction"
>> name="UserForm"
>> type="com.whatever.UpdateUserAction"
>> validate="true"
>> input="app.EditUser"
>> scope="request">
>> <forward name="success" path="/editUser.do" />
>> <forward name="cancel" path="app.Home" />
>> <forward name="failure" path="/editUser.do" />
>> </action>
>>
>> </action-mappings>
>>
>>
>> In any case, in doing this, it seems to me that it would make sense if
>> you could
>> make an action create a transaction token by some entry in the
>> struts-config.
>>
>>
>>
>> --
>> Steve Stair
>> Steve.Stair@rrc.state.tx.us
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>
>
>
--
Igor Shabalov
Director of Engineering
Exadel Inc.
http://www.exadel.com