You can use 3 differents FlightBean and then populate the *value
attribute* in each <html:text/>
When you click only one form submit is sent

Luis Gervaso


On Fri, 22 Oct 2004 15:28:16 +0900, Bill Keese
<[EMAIL PROTECTED]> wrote:
> I have a question about pre-populating the fields of a form you display
> in the browser. To pre-populate fields, the Action saves a Form bean in
> the context via request.setAttribute("inputForm", inputForm), and
> <html:form> tag looks up the form bean.
> 
> <html:form> determines the form bean's name automatically based on the
> specified action and the settings in struts-config.xml. But, what if you
> wanted a web page with multiple forms all pointing at the same action?
> For example, an airline ticket website might display 10 possible flights
> and have a button to book each flight. All the buttons point at the same
> bookFlight action, but the flight number attribute is different.
> 
> In other words, how do I implement the code below without using the
> "name" (or beanName) attribute:
> 
> MyAction.java:
> request.setAttribute("inputForm1", new InputForm("$499", "flight 31"));
> request.setAttribute("inputForm2", new InputForm("$599", "flight 32"));
> request.setAttribute("inputForm3", new InputForm("$699", "flight 33"));
> 
> MyPage.jsp:
> <html:form beanName="inputForm1" action="bookFlight.do">
> <html:button ... />
> </html:form>
> <html:form beanName="inputForm2" action="bookFlight.do">
> <html:button ... />
> </html:form>
> <html:form beanName="inputForm3" action="bookFlight.do">
> <html:button ... />
> </html:form>
> 
> Bill
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
Un saludo

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to