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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:53:37+00:00 2026-06-18T01:53:37+00:00

I want to do the below thing in JSP starting from for loop –

  • 0

I want to do the below thing in JSP starting from for loop– I just want to loop HashSet and HashMap and print the result

private static HashMap<Long, Long> histogram = new HashMap<Long, Long>();
private static Set<Long> keys = histogram.keySet();

for (Long key : keys) {
    Long value = histogram.get(key);
    System.out.println("MEASUREMENT, HG data, " + key + ":" + value);
}

I am working with Spring MVC, so I added these two things in my model

model.addAttribute("hashSet", (keys));
model.addAttribute("histogram", (histogram));

And in my JSP page, I was doing something like this to emulate the above JAVA code but it was giving me an exception that something is wrong in my JSP page.

<fieldset>
    <legend>Performance Testing:</legend>
        <pre>

            <c:forEach items="${hashSet}" var="entry">
            Key = ${entry.key}, value = ${histogram}.get(${entry.key})<br>
            </c:forEach>


        </pre>
        <br />
</fieldset>

Exception I got-

Caused by: javax.el.PropertyNotFoundException: Property 'key' not found on type java.lang.Long
    at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:195)
    at javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:172)
    at javax.el.BeanELResolver.property(BeanELResolver.java:281)
    at javax.el.BeanELResolver.getValue(BeanELResolver.java:62)

Can anyone help me out with this?

  • 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-18T01:53:38+00:00Added an answer on June 18, 2026 at 1:53 am

    You don’t need to make use of keySet to access the values in the HashMap. When you iterate over HashMap using <c:forEach..>, you get back the EntrySet, for which you can use: – EntrySet#getKey() and EntrySet#getValue() directly: –

    <c:forEach items="${histogram}" var="entry">
         Key = ${entry.key}, value = ${entry.value}<br>
    </c:forEach>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have so far accomplished the below written thing.. I want to retrieve the
The form below is working as I want except for one thing. When I
First Table is the View and Second is the result I want This below
I have the below but want to only loop through lines in #lines which
I want to achieve below thing in vtd-xml xml modifier class. Original xml <xml>
I want to run git commands from c#. below is the coded I had
The thing what I want to do is just replacing one field of structure
I am a beginner in openGl. I am doing very basic thing. Just want
I want a static constant, LIST_DELIMITER , defined in my class below. However, I
I want to achieve same thing like the SQL code below (it works)shown in

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.