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 9183521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:49:27+00:00 2026-06-17T18:49:27+00:00

I am sending a list of custom objects with model, and a JSP as

  • 0

I am sending a list of custom objects with model, and a JSP as a view. My custom object has a property called properties and it is JSONObject. This property will have the value as

{"services":[{"name":"abcd"},{"name":"efgh"}]}

now I want to iterate through the JSONArray [{"name":"abcd"},{"name":"efgh"}]. Here is what I am doing to loop through

<c:if test="${not empty customObject.services}">
                 <c:forEach items="${customObject.services.getJSONArray(\"services\")}" var="Service" varStatus="rowCounterCh">
                     <li>${Service.name}</li>
                  </c:forEach>
 </c:if>

But this is not able to iterate through the JSONArray. Am getting following error.

javax.servlet.ServletException: javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in &lt;forEach&gt;

So, what should I do to iterate through the JSONArray? Pls help

  • 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-17T18:49:28+00:00Added an answer on June 17, 2026 at 6:49 pm

    For each tag should require a base interface for your items. JSONArray neither java.util.Collection nor java.util.Iterable. So For each tag implementation cannot iterate over the collection you pass into items attribute.

    To solve this problem you may:

    1. Generate HTML list view with JSP.
    2. Or list item convert JSONArray into some appropriate Collection in customObject.services.getJSONArray method. JSONArray in gson implementation should has method: iterator, because it implements the Iterable interface. Try to return an com.google.gson.JSONArray#iterator() instead of JSONArray in your #getJSONArray(String) method.

    more detailed explanation

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

Sidebar

Related Questions

How do I return a custom object which uses generic as an empty list?
Say from a PC, a SSH client will be sending commands (such as custom
i am sending array list items[x,y,z...] to the custom adapter. i want display items
Im sending a list from my controller class to my View which contain a
We are having a SerializationException error when sending a list of objects using RPC
Hi I'm going through this loop and sending a list of words lines and
The server is sending a list of urls of images when the application loads.
i need create an email list sending to many emails. what is best solution
i am sending out email to a list of people. I have the list
i am sending an ordered json_encode list of some MySQL tables, from php, but

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.