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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:08:11+00:00 2026-05-15T07:08:11+00:00

I have a HashMap object that I am getting on a JSP page. HashMap<Integer,Gift_product>

  • 0

I have a HashMap object that I am getting on a JSP page.

HashMap<Integer,Gift_product> gift_hm = new HashMap<Integer,Gift_product>();
gift_hm.put(17,new Gift_product("doll",67));

Now I need to iterate this and display content on JSP.
The Gift_product class contains two fields: name and price.

JSP output should be

serial no.           product name     price
17                    Doll            67

How can I achieve it?

  • 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-05-15T07:08:11+00:00Added an answer on May 15, 2026 at 7:08 am

    Check out the struts <logic:iterate> tag. When iterating over a HashMap, each entry is a java.util.Map.Entry, to get the key (in this example the serial number) and value (the Gift_product object) out use the key and value properties like this:

    First set the HashSet as an attribute in your action class e.g. request.setAttribute("gift_hm", gift_hm); and then in the jsp:

    <logic:iterate id="mapEntry" name="gift_hm">
      <bean:define id="gift" name="mapEntry" property="value">
      <tr>
        <td><bean:write name="mapEntry" property="key"></td>
        <td><bean:write name="gift" property="productName"></td>
        <td><bean:write name="gift" property="price"></td>
      </tr>
    </logic:iterate>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 496k
  • Answers 496k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you don't use sequentially numbered elements, you'll have to… May 16, 2026 at 11:46 am
  • Editorial Team
    Editorial Team added an answer Try this: #Today Posts.find(:all, conditions: { :created_at => Date.today...Date.today +… May 16, 2026 at 11:46 am
  • Editorial Team
    Editorial Team added an answer If you can't use SSL, which is the only sane… May 16, 2026 at 11:46 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm getting blocked on a jsp page and our 1 java engineer isn't able
I have a HashMap that I'm using in Processing and I'd like to increment
I have a set of classes that all need to be acted on in
I have my own hand-rolled PHP MVC framework for some projects that I'm working
I need help getting my head around the difference between my current OOP notion
Have I correctly added an element to a hashTable? Flows flows = new Flows(sIP,dIP);
Have noticed issue while testing iphone app that if one quickly opens/dismisses a modal
Edit: I've figured out the constructor for the singleton is getting called multiple times
I am having some problems getting some French text to convert to UTF8 so
This method that uses method-level generics, that parses the values from a custom POJO,

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.