PKrishna Tamuli
PKrishna Tamuli

Reputation: 21

How to iterate a list and show in drop down in jsp

I have some data in my list and I am trying to add those in a dropdown list .I am trying to iterate the list and adding in the dropdown. But I am not getting the proper result . Below are my code can anybody please help me out.

<select>    
    <logic:iterate name="CMSSetupForm" property="configListMetaData"        id="configVO" type="com.infores.mdm.ui.domainobjects.cms.ConfigurationVO"  indexId="indid">
    <option value="<bean:write name="configVO" property="attributeGroup"/>">
   </option>

  </logic:iterate>
</select>

Thanks in advance.

Upvotes: 0

Views: 2543

Answers (1)

Ravi Kumar
Ravi Kumar

Reputation: 993

You can use JSTL for this

Here is a nice tutorial

You can use forEach of core taglib like this -

<c:forEach items="${names}" var="name">
    <option value="${name}">${name}</option>
</c:forEach>

Assuming names is a List of String like this -

List<String> list = new ArrayList<String>();

Upvotes: 1

Related Questions