Announcement Announcement Module
Collapse
No announcement yet.
<form:options tag Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • <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..

  • #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?

    Comment


    • #3
      Yeah, that works well. Thanks.
      Nick..

      Comment

      Working...
      X