HI Ranchers,
This is my humble request, i am not being able to solve this problem from 2 days,
The bean is having the values but i am not able to get that in the jsp (because the collection is null in the jsp).
I am again listing my entire code
1.Action class
try {List list = this.getMaritalStatus();
ArrayList status =new ArrayList();
Iterator i = list.iterator();
maritalStatus sts= new maritalStatus();
int k=0;
while(k<list.size())
{sts=(maritalStatus)list.get(k);
status.add(sts.getMarital_status_id());
k++;
}
sts.setMarital_status_list(status);
}
catch (Exception ex) {
throw new ServletException(ex.toString());
}finally {return mapping.findForward(target);
}
}
public List getMaritalStatus() {
Session session = HibernateUtil.currentSession();
List list=session.createQuery( "from maritalStatus").setCacheable(true).list(); HibernateUtil.closeSession();
return list;
}
2.My bean
private String marital_status_id;
private Collection marital_status_list;
private String description;
which has get and set methods
3.My jsp
<html:select property="marital_status_id" name="maritalstatus" multiple="true" >
<html
ptionsCollection name="maritalstatus" property="marital_status_list" value="marital_status_id" label="description"/>
</html:select>
4.my struts config are correct
5.error i am getting is
[Servlet Error]-[Failed to obtain specified collection]: javax.servlet.jsp.JspException: Failed to obtain specified collection
This is because the collection is having null value
Kindly help me in solving this issue
Thanks