Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8186661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:17:18+00:00 2026-06-07T02:17:18+00:00

I want to iterate through a List that is a member variable of a

  • 0

I want to iterate through a List that is a member variable of a User object.
I don’t want to use snippets and would like to use some form of jsp tags to do the trick.

User class

public class User {

  private List<Option> options;

  public getOptions()...
}

What I’m trying to do in snippets

<%
User user = (User)session.getAttribute("user");
List<Option> options = user.getOptions();
%>

<select id="alertFilter">

<% for (Option o : options) { %>

<option><%=o.getTitle()%></option>

<% } %>

</select>

I’ve seen a few simple examples of what I’m trying to do but they always get simple ojects back.

Tag Library way – not working

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<jsp:useBean id="user" class="ie.openmobile.smsjobs.entity.User" scope="request"></jsp:useBean>

<c:forEach var="options" items="$user.options" >   <--incorrect references to alerts/getOptions()

<br>$options.title   <--incorrect syntax

</c:forEach>

Can anyone help me out?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:17:19+00:00Added an answer on June 7, 2026 at 2:17 am

    Change it to as follows

    <select id="alertFilter">
    
    <c:forEach var="option" items="${user.options}" >
      <option><c:out value="${option.title}"/></option>
    </c:forEach>
    
    </select>
    

    Explanation : ${user.options} will get the user from session and options collection using its getOptions() method, and it will iterate on each entry

    While under the iteration ${option.title} would give the option ( which is the current option instance under traversal) and option.getTile()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a variable list of associative arrays that I want to iterate through
I want to iterate through a list that contains a mix of lists and
Basically I have a list of methods that I want to iterate through, call
I want to use jQuery to iterate through a list of <div> s in
I want to iterate through a list, and remove the items that count more
In the code below, I have a List object. I want to iterate through
I want to iterate through a table/view and then kick off some process (e.g.
I want to iterate through store and make grid columns dynamically. When I use
jquery looks like this $.post('JSP/processForm.jsp', $(#Form).serialize(), function(data){ //I want to iterate through every line
I use this method called SearchConsequences to iterate through List<ValuesEO> of objects and perform

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.