Hi:
I have a struts application that allows me to update a list of employees
data.
The following is a 'desired' Update screen to update all employees
information on 'one' screen:
Employee Name Employee Age Department (this is a drop down)
Anderson, John 30 a drop-down list of Boston-branch
departments to choose from
Johnson, Mary 35 a drop-down list of Portland-branch
departments to choose from
Wilson Bob 25 a drop-down list of L.A-branch
departments to choose from
------------------------------------------------------------------------
My Data Beans:
// the department property will be populated based on the selection from
the drop-down
// 'departmentDropDown'. Each employee has it's unique drop-down
'departmentDropDown'.
public class EmployeeDTO {
private String name;
private String age;
private String department;
private ArrayList departmentDropDown; // this list can be different for
different employees
}
Public class DepartmentBean {
private String id;
private String dName;
}
----------------------------------------------------------------------------
My EmployeeForm:
public class EmployeeForm extends org.apache.struts.action.ActionForm
implements Serializable {
private ArrayList listOfEmployees;
private EmployeeDTO employee;
private ArrayList aDropDown;
}
----------------------------------------------------------------------------
My UpdateEmployees.jsp:
<jsp:useBean id="listOfEmployees" type="java.util.Collection"
scope="session"/>
<logic:iterate id="emp" name="listOfEmployees"
type="com.myCompany.EmployeeDTO ">
<tr>
<td><html:text property="name"/></td>
<td><html:text property="age"/></td>
<td>
<html:select name="emp" property="department">
<html:options collection="emp.departmentDropDown" property="id"
labelProperty="dName"/>
</html:select>
</td>
</tr>
</logic:iterate>
** listOfEmployees is an ArrayList of 'EmployeeDTO' in session.
** each empoloyee's departmentDropDown has been set as an ArrayList of
'DepartmentBean'.
But when I ran I keep getting an error like this:
Cannot find bean under name emp.departmentDropDown'
javax.servlet.jsp.JspException:
Cannot find bean under name emp.departmentDropDown at
org.apache.struts.taglib.html.OptionsTag.getIterator(....
Did I struture my <html:options> within the <logic:iterate> wrong? If it is
wrong, how do I display a <html:options> within a <logic:iterate>?
--------------------------------------------------------------
I modiefied my JSP and tried another way but it doesn't work either:
<jsp:useBean id="listOfEmployees" type="java.util.Collection"
scope="session"/>
<logic:iterate id="emp" name="listOfEmployees"
type="com.myCompany.EmployeeDTO ">
<bean:define id="aDropDown" property="emp.departmentDropDown"
<tr>
<td><html:text property="name"/></td>
<td><html:text property="age"/></td>
<td>
<html:select name="emp" property="department">
<html:options collection="aDropDown" property="id"
labelProperty="dName"/>
</html:select>
</td>
</tr>
</logic:iterate>
Then I will get this error:
[ServletException in:/jsp/part/editSubsystemPart.jsp] Cannot find bean under
name aDropDown'
javax.servlet.jsp.JspException: Cannot find bean under name aDropDown
at org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:407)
at
Any help will be appreciated...
Stella
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]