struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul McCulloch <paul.mccull...@axiossystems.com>
Subject RE: Passing multiple ActionForms (at the same time) to an Action
Date Thu, 19 Jun 2003 12:32:08 GMT
In the situation I describe I want two forms to be submitted to the search
action *at the same time*- one representing the currently entered details of
the booking & one representing the entered search criteria. The action
should return both of these forms unmodified (to preserve data the user has
entered) and create a bean representing the search results.

I want to use struts forms for both the booking data and search criteria so
that when the view is created the previously entered values are preserved -
that is one the things struts is doing for me (isn't it?)

Does that make sense?
Is there an alternative to creating a 'super form' containg the 'real' data
and the search criteria data?

Or do I just not get it?

thanks,

Paul

> From: Ted Husted [mailto:husted@apache.org]
<snip>
> HTTP only allows you to submit a single "form". If you then need to 
> express an incoming form as two forms on a result page, you 
> can post the 
> incoming form bean under another attribute name (or names). Then each 
> form on the result page will take the properties it needs, based on 
> which form-bean was specified for its mapping.
> 
> -T.
> 
> Paul McCulloch wrote:
> > Hi,
> > 
> > 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.
> > 
> > Paul
> > 
> > 
> > **************************************
> > 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.
> > WARNING:
> > 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: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> -- 
> Ted Husted,
> Struts in Action <http://husted.com/struts/book.html>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 

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


Mime
View raw message