-
Nov 14th, 2007, 08:54 AM
#1
<form:options tag
Hi,
Can't seem to find any docs on how to use the <form:options tag completely. I found the following, which is ok for the HTML, what what exactly does the 'code' and the 'name' correspond to?
I guess this is something in the 'countryList'. Would 'countryList' be a list of objects called country containing attributes of 'code' and 'name'? I need to find out how to define the java code to interact with this.
<tr>
<td>Country:</td>
<td>
<form:select path="country">
<form:option value="-" label="--Please Select"/>
<form:options items="${countryList}" itemValue="code" itemLabel="name"/>
</form:select>
</td>
<td></td>
</tr>
Thanks,
Nick..
-
Nov 14th, 2007, 12:42 PM
#2
Right, "code" and "name" correspond to properties on objects in the Collection represented by the JSTL expression "${countryList}". "countryList" would usually be a named element that you put into your Model in your controller (most likely referenceData method, for *FormControllers). path=country on the form:select corresponds to the "country" property on the command object (or whatever path you bound in your form:form tag). Hope that helps?
Peter Mularien | Blog
Author, Spring Security 3 (Book) - Packt Publishing, Available in print and eBook form
SCJP 5, Oracle DBA
Any postings are my own opinion, and should not be attributed to my employer or clients.
-
Nov 15th, 2007, 02:24 AM
#3
Yeah, that works well. Thanks.
Nick..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules