• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Displaying Values in JSP Page using Struts

Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I am new to struts I am getting problem while displaying the values in JSP page while using HashMap and ArrayList

/*This is the code for Array List*/

ArrayList al = new ArrayList();

I want to display the contents of al object in JSP Page using Stuts <logic:iterate> tag . Thing is this al object is having more that one value
so with out struts we can use for loops and Enumerations to display the value. But pls help me how to display this using struts logic:iterate tag.

Pls give me sample code.

/*This is my hash map code*/

HashMap hm = new HashMap();

The above is my HashMap code i have diplay this value in JSP using logic:iterate tag.

Pls Provide me code for this.

Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These links should get you started.
Indexed and Mapped Properties

Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One possibility..

First make sure you have the hashmap is in context (use a tag to put it into page context), or just put it in the session if it will be used over several pages..
Let's assume it's in page context, with the name 'contextHash':

<logic:iterate id="dbHash" name="contextHash" type="java.util.HashMap">
Name:<bean:write name="dbhash" property="name" />
Age:<bean:write name="dbhash" property="age" />

Didn't test it.. hopefully it'll help you out.

There's an example of this in the docs.. here
Yeah. What he said. Totally. Wait. What? Sorry, I was looking at this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic