Is it possible to use multiple params in the itemLabel of a form:select/form:option Is it possible to use multiple params in the itemLabel of a form:select/form:option spring spring

Is it possible to use multiple params in the itemLabel of a form:select/form:option


I don't think so. Either have a getFullName() getter in your object returning the concatenation of last and first names, or display the options one by one, in a loop:

<form:select id="userSelect" name="userId" path="user.id">    <option value="">Select to Edit</option>    <c:forEach var="theUser" items="${user.userList}">        <form:option value="${theUser.id}"><c:out value="${theUser.lastname} ${theUser.firstname}"/></form:option>    </c:forEach></form:select>

With concatenation performed by user.getFullName():

<form:select path="user"   items="${user.userList}"   itemValue="id"   itemLabel="fullName"></form:select>