ActionForm objects are representation of a form and the data in the form. It holds the values of your <INPUT>, <SELECT>, <TEXTAREA> and other form controls.
The options of a <SELECT> control are only used to help the user choose a value; its only purpose is to give the <SELECT> control a value and isn't itself a value of the form. Think of it this way: the form doesn't lose any data by changing your <SELECT> into an <INPUT type=text>. Confused? Think of it another way: The <OPTION> values don't get submitted, only the value of the <SELECT>. So: 1) The ActionForm helps you get to the values submitted with the form, and so "suburb" is required there because it's part of the form. 2) The ActionForm doesn't hold <OPTION> values, only the value of the <SELECT>. 3) You need a way to tell <html:options> what to show, and you can do it by specifying a collection that's in scope (doesn't have to be the request scope). Hope all that didn't confuse you further. --- Craig Edwards <[EMAIL PROTECTED]> wrote: > I've been fiddling around with Struts for a while now and am still a > little puzzled as to whether JSPs should be getting their data from my > DynaActionForm or from the session/request context. For example, if my > JSP contains: > > <html:select property="selectedCustomer" size="5"> > <html:options collection="customers" property="id"/> > </html:select> > <html:text property="suburb" size="16" maxlength="18"/> > > The way I have this working currently is by adding "customers" to the > request context and by having "suburb" declared in my DynaActionForm. I > don't appear to have to declare "customers" in the form, but if I don't > declare "suburb", I get an error... what is the difference? > > P.S. If it helps clarify things, the JSP I have displays a list of > customers and some input fields. The user can update the input fields, > press submit and they see the same page (with the new details displayed > in the list). Many thanks. > > -- > Craig Edwards > Sydney, Australia > __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]