J
jgalzic
I have a form with a bean that has nested beans and I'm having trouble
putting a specific value into a form's 'option' value attribute. The
final html would look
something like:
<select name = "customers">
<option value="cust1000">Jon Doe</option>
<option value="cust2000">Jeff Newworth</option>
<option value="cust3000">Amy Madigan</option>
</select>
The ActionForm contains the bean with nested beans and the error mesage
I get from Tomcat is "Cannot find bean under name customer".
My form and bean classes are defined as:
public CustomerFormBean extends ActionForm
{
CustomerBase getCustomerBase() { return customerBase; }
private CustomerBase customerBase;
}
public class CustomerBase
{
public Object[] getCustomers() { return customers.toArray(); }
private ArrayList customers;
}
public class Customer
{
public String getName() { return name; }
public String getId() { return id; }
}
My jsp code looks like this:
<nested:form action='CustomerAction.do'>
<html:select property="selectedCustomer">
<nested:nest property="customerBase">
<nestedptions collection="customers" name="customer"
property="id"/>
</nested:nest>
</html:select>
</nested:form>
What am I doing wrong here?
I'd also like to find which out the selected Index of the drop down and
send it back during the submit. How can I do that?
Thanks,
Justin
putting a specific value into a form's 'option' value attribute. The
final html would look
something like:
<select name = "customers">
<option value="cust1000">Jon Doe</option>
<option value="cust2000">Jeff Newworth</option>
<option value="cust3000">Amy Madigan</option>
</select>
The ActionForm contains the bean with nested beans and the error mesage
I get from Tomcat is "Cannot find bean under name customer".
My form and bean classes are defined as:
public CustomerFormBean extends ActionForm
{
CustomerBase getCustomerBase() { return customerBase; }
private CustomerBase customerBase;
}
public class CustomerBase
{
public Object[] getCustomers() { return customers.toArray(); }
private ArrayList customers;
}
public class Customer
{
public String getName() { return name; }
public String getId() { return id; }
}
My jsp code looks like this:
<nested:form action='CustomerAction.do'>
<html:select property="selectedCustomer">
<nested:nest property="customerBase">
<nestedptions collection="customers" name="customer"
property="id"/>
</nested:nest>
</html:select>
</nested:form>
What am I doing wrong here?
I'd also like to find which out the selected Index of the drop down and
send it back during the submit. How can I do that?
Thanks,
Justin