You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ma...@xfield.co.uk on 2002/12/13 16:08:46 UTC
Chaining actions
Hopefully someone can advise me how to get round this.
Essentially I have an action that prepares a page, then forwards to a jsp. The
jsp submits back to the same action, the action carries out certain operations
dependant upon a hidden flag, then if necessary forwards on to another action,
or reshows the same jsp with information updated.
I want my code to work as follows (the system is designed so every action has
an associated jsp and form):
1. LibraryAction (extracts info from the database), and fills a LibraryForm
2. forwards to libraryAction.jsp
3. user selects "addArea", and submits form
4. LibraryAction receives the LibraryForm, and finds that the user wishes to
add an area
5. so LibraryAction forwards to LibraryAreaAction.
6. LibraryAreaAction receives a *blank* LibraryAreaForm, fills it as necessary
7. forwards to libraryAreaAction.jsp
8. user fills in details and submits the LibraryAreaForm.
9. LibraryAreaAction carries out operations on the LibraryAreaForm.
10. LibraryAreaAction forwards to...
11. etc...
However, these steps happen instead:
5. LibraryAreaAction forwards to LibraryAreaAction.
6. A new LibraryAreaForm is created, and populated with values submit at step
3.
7. The values are meaningless to this form, so validate finds errors.
8. Control is forwarded to the jsp related to LibraryAreaForm -
libraryAreaForm.
9. Many values haven't been added to the request yet as LibraryAreaAction
hasn't been run yet.
10. The jsp fails with runtime errors (Struts can't find beans...).
I've tried changing scope from session to request and page, and have ensured
that the reset() resets all values on the form (however the form is populated
after the reset() is run).
I hope that makes sense! If it does, do you know a way out of this?
Thanks
Ian
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>