Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How can i loop through my collection in my jsp?

843838Oct 5 2005 — edited Oct 5 2005
hi all,
in my struts web application,
i am setting up like this in my controller class:

req.setAttribute(item,itemList);

and using as below to get the dropdownlist which is working fine.

<html:select property="itemType" styleId="itemType">
<html:option value="">Please Select</html:option
<%List aList = (List) request.getAttribute(item);
Iterator i = aList .iterator();
while (i.hasNext()) {
String aValue = (String) i.next();%>
<html:option value="<%=aValue %>">
<%=aValue %>
</html:option>
<%}%>
</html:select>

this is working quite fine now but i want to use logic iterate to go through the array.my main intention is to minimize java code in my jsp.
how can i use logic ierate to loop through?

any ideas?

regards and thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 2 2005
Added on Oct 5 2005
6 comments
279 views