Trying to get list of companies in select
but it gives me an error.
type Exception report
message tag 'select', field 'list', name 'workOrder.company': The requested list key
'listAllCompanys' could not be resolved as a collection/array/map/enumeration/iterator
type. Example: people or people.{name} - [unknown location]
description
The server encountered an internal error that prevented it from fulfilling this request.
Exception:
org.apache.jasper.JasperException: tag 'select', field 'list', name 'workOrder.company': The requested list key 'listAllCompanys' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:585)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
my workOrder.jsp
file containing :
<s:select list="listAllCompanys" listValue="companyName" name="workOrder.company"></s:select>
When I have a new work order to add, there should be a list of companies available in select .
UPDATE:
Here's my listAllCompanies()
method
public List<Company> getCompanyList() {
return companyList;
}
//////////////////////////////////////////
/////////////////////////////////////////
public List<Company> getListAllCompanys() {
return listAllCompanys;
}
private List<Company> listAllCompanys;
public String listAllCompanys() throws Exception
{
CompanyDaoHibernate dao = new CompanyDaoHibernate();
listAllCompanys = dao.getListOfCompanys();
return SUCCESS;
}
CompanyDAOHibernate
:
public List<Company> getListOfCompanys()
{
SessionFactory sf = HibernateUtil.getSessionFactory();
Session session = sf.openSession();
@SuppressWarnings("unchecked")
List<Company> returnList = (List<Company>)session.createCriteria(Company.class).list();
session.close();
System.out.println("Printing companies... "+returnList);
return returnList;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…