struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul McCulloch <>
Subject Passing multiple ActionForms to an Action
Date Wed, 18 Jun 2003 13:06:46 GMT

I'm a struts newbie, so forgive me if this is a FAQ. Is there a way to
submit multiple ActionForms to a single Action?

I'm trying to implement search functionality on the same page as the view's
primary function. I think an example would help...

Consider a simplified ticket booking system. The booking view allows the
user to book a number of tickets for one show. It has fields for Customer,
Performance, number of tickets & free text remarks.

The Customer & Performance fields each have an associated serach button. If
the user presses the 'Performance Search' button then the view is redrawn
showing the booking details already entered on the left and a Performance
Search 'pane' on the right. 

The search pane includes criteria such as 'show', 'venue', 'time' etc. And a
'search now' button. Pressing the 'search now' button brings back, in the
search pane a list of matching performances. Clicking on a performance in
the list populates the performance field in the booking pane.

It is also possible for the user to enter remarks, whilst using the search
function without losing those remarks.

The Customer search function works in a similar manner, and is displayed in
place of the performance search when in use.

With me so far? (thanks for reading).

Working under the assumption that I can't submit two forms (the booking &
the search criteria) to a single action (the search action) I have come up
with the following implementation:

I have a single form containing all of the booking fields and all of the
search criteria fields, with the view generating a different single html
form definition depending on which of the search 'modes' should be visible.
This seems to work ok.

A second requirement is that these 'search functions' be resueable on other
views. To this end I have defined the search fields in my form class via a
map (so that I don't need to redefine the form class, just to add a new
search criteria). I intend to wrap up the display logic in some custom tags.

Is this is a sensible approach? Or is there a simpler way? Ideally I'd like
my generated html to include multiple forms - one for the booking and one
for the search, but if I do this then how do I send my booking form & search
form to the search action (so that the page can be redrawn with any modified
booking details preserved?

Many thanks for any input.


Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you are not the addressee
indicated in this message (or responsible for delivery of the message to such person), you
may not copy or deliver this message to anyone. In such case, you should destroy this message,
and notify us immediately. If you or your employer does not consent to Internet email messages
of this kind, please advise us immediately. Opinions, conclusions and other information expressed
in this message are not given or endorsed by my Company or employer unless otherwise indicated
by an authorised representative independent of this message.
While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via
electronic mail attachments we cannot guarantee that attachments do not contain computer virus
code.  You are therefore strongly advised to undertake anti virus checks prior to accessing
the attachment to this electronic mail.  Axios Systems Ltd grants no warranties regarding
performance use or quality of any attachment and undertakes no liability for loss or damage
howsoever caused.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message