Hi peeps
Could someone recommend the best way of populating a drop down list in
edit/add forms? New to spring mvc and not sure of the correct way of
going about it.
I have a list of countries stored in the database. Access to these are
provided by a Generic Manager for crud. One of my edit pages needs to
associate the object with a Country. I've tried to do it with
referenceData but I'm getting problems.
protected Map referenceData(HttpServletRequest request) throws Exception {
Map retval = new HashMap<String, Object>();
retval.put("countryList", countryManager.getAll());
return retval;
}
The above does return a list of country objects.
I've got the below in my jsp:
<form:select path="contact.country">
<form:option value="-" label="--Please Select"/>
<form:options items="${countryList}" itemValue="id" itemLabel="name"/>
</form:select>
Unfortunately this throws a JasperException when I try to load the
page. If I remove the above from the jsp the page works fine.
From my googling, it seems I may need to use a PropertyEditor, but I
can't find any concrete examples of what I'm trying to do, and how to
use the PropertyEditor in this context.
Methinks I really need to buy a spring mvc book ;-)
Any ideas?
Thanks
Aled
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]