Please help me, I'm having an error in the dropdown list. We tried to populate the dropdown using the MySQL database but it doesn't work and then we tried to hardcode the dropdown and it works. Am I doing it wrong? I would highly appreciate your answers Thank you!!
jsp
<s:form action='Admin' method='post'>
<s:select label="Select Clinic"
name="clinicChoices"
headerValue="Select Clinic"
list="%{clinicChoices}"
/>
controller
private List<String> clinicChoices;
public List<String> getClinicChoices() {
return clinicChoices;
}
public void setClinicChoices(List<String> clinicChoices) {
this.clinicChoices = clinicChoices;
}
@Override
public void prepare() throws Exception {
clinicChoices =new ArrayList<String>();
ResultSet rs=ClinicBean.getAllRecords();
while(rs.next()){
clinicChoices.add(rs.getString("clinicName"));
}
}
public String clinicList() throws Exception{
return SUCCESS;
}
This is the error message:
tag 'select', field 'list', name 'clinicChoices': The requested list key '%{clinicChoices}' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]