On 1/15/2001 at 11:28 PM Johann Dorn wrote:
> Can anyone give me an example or some hints how the options-Tag must be used in conjunction with the ActionForm?
 
Sorry, got distracted, and I never actually did that.
 
So, starting with a working example of an ArrayList "options" bean in request scope, I setup a ArrayList property on the form, with the usual protected variable and standard getter/setter.
 
[ActionForm]
  protected ArrayList salesYearsList = null;
  public ArrayList getSalesYearsList() {
    return (salesYearsList);
  }
  public void setSalesYearsList(ArrayList salesYearsList) {
    this.salesYearsList = salesYearsList;
  }
 
[Action]
     salesForm.setSalesYearsList(salesYearsList);
     if (salesYearsList != null) request.setAttribute("salesYears",salesYearsList); // still works
 

But I couldn't come up with a set of parameters that will work, or see how this is supported from the source code (but then, I'm a little dim ;-).
 
Anyway, starting with the working bean version,
 
<form:select property="year">
<form:options collection="salesYears" property="value" labelProperty="label"/>
</form:select>
here's what I tried
 
<form:select property="year">
<form:options property="salesYearsList"/>
</form:select>
// Servlet exception, ClassCast exception
 
<form:select property="year">
<form:options property="salesYearsList.value"/>
</form:select>
//No getter method available for property salesYearsList.value for bean under name null
 
<form:select property="year">
<form:options property="salesYearsList" labelName="value" labelProperty="label"/>
</form:select>
// Cannot find bean under name value
 
<form:select property="year">
<form:options property="salesYearsList" name="value" labelProperty="label"/>
</form:select>
// Cannot find bean under name value
 
<form:select property="year">
<form:options property="salesYearsList" name="value"/>
</form:select>
// Cannot find bean under name value
 
<form:select property="year">
<form:options property="salesYearsList" labelProperty="label"/>
</form:select>
// No getter method available for property label for bean under name null
 

Reply via email to