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]