struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: Totally stuck handling forms
Date Thu, 02 Dec 2004 10:16:43 GMT

Hi Alex,
put a pair of getter/setter methods for dispatch into your form and then 
use a hidden field to pass the variable on.

The method you outline though seems overcomplicated, although it could 
be just that it seems so because it's not totally clear what the flow of 
control is meant to be. I would avoid chaining your action mappings 
together for this relatively simple set of operations.

For the create action for instance, your first action should do the 
set-up, and then the submit from the JSP should go to the processing 
part, i.e. you have 2 dispatch actions: create-setup and create-submit

Adam

On 12/01/2004 11:51 AM Alexander Czernay wrote:
> I'm still trying to find a nice way for handling standard 
> list/create/edit/delete-forms...
> 
> After browsing through all the hints and tips I got from here, I started 
> building an initial form-setup-action using DispatchAction with a 
> parameter dispatch that should be set to list, create, edit or delete, 
> depending on the action wanted. That form-setup-action should 
> pre-populate the form as needed and then forward to the apropriate 
> action for display. There are two further actions; one for listing all 
> existing entries (form-list-action, a LookupDispatchAction) and another 
> for displaying an individual entry for editing (form-edit-action).
> 
> Now I tried to stick it all together passing parameters around. But 
> exactly that doesn't work as expected: On the list-form I present a list 
> of all entries available together with submit-buttons for 
> edit/delete-actions for each individual entry. There also is a single 
> create button for creating new entries. Pressing the create-button 
> invokes a create-method in the form-list-action that calls a forward 
> named "create". That forward points back to the form-setup-action with 
> "?dispatch=create" added to the path. The form-setup-action should then 
> forward to the appropriate form-create-action, but it looks like the 
> dispatch parameter isn't passed on to the form-setup-action.
> 
> I wonder if this approach is ok or if there are better ones? How could 
> the parameters be passed from one action to another (I couldn't find any 
> parameter one could add to a <forward>-tag to pass paramaters that way.


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


Mime
View raw message