简体   繁体   中英

How to get all the item of a jstl select in MVC Spring controller from view

I am using Spring MVC and JSTL tag for jsp pages as frontend ... I have a jstl select option in view ... the select is populated from db ....now I want that if I press a submit butten ... I can get all the item of the list box back to the Spring MVC controller.. How can I do this ???

Here is my JSTL Select box :-

<form:select id="upperTier" path="propertyCode" cssClass="textfield">
<c:if test="${upperTyrePropertyCodeList!=null}">
<form:options items="${upperTyrePropertyCodeList}" itemValue="propertyCode" itemLabel="propertyCode" />
</c:if>
</form:select> 

Now I want all the items of select box (upperTyrePropertyCodeList) back to the controller ... not any select ted index ....

if you want to all upperTyrePropertyCodeList back to you submit action,you can do like this:

<c:forEach var="index" items="${upperTyrePropertyCodeList}">    
  <form:hidden name="propertyCode" value="${index.propertyCode}"/>
</c:forEach> 

select box only hold the selected value to controller.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM