Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

accessing a Collection through a jsp-bean

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
I have a Struts form-bean which contains a HashMap. The keys of this hashmap is an object of type GeSectionComponent. In my jsp, I iterate over a collection of these GeSectionComponents. For each iteration, I would like to lookup in the HashMap to retrieve the value corresponding to the GeSectionComponent. Does anyone have an idea of how to do this?

I have bee trying to use the JSTL c:set-tag to be able to use the GeSectionComponent as a variable in my jsp, but I can't seem to get it to work. Absolutely non-working code looks something like:

<logic:iterate id="geSectionComponent" name="initialReportForm" property="geSectionComponents">
<c:set var="comp" value="???"/>
<jsp:useBean id="comp" type="com.acme.ge.generated.GeSectionComponent" />
<% ???.getPowerLimits(comp); %>
</logic:iterate>

My form contains a getter for the HashMap:

public HashMap getPowerLimits() {
return powerLimits;
}

any help would be appreciated!

cheers,
pj
 
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no idea how the 'logic' tags work under the covers, so I don't have any input on how to make them work in conjunction with the JSTL tags. I'd recommend either forgoing the proprietary tags and using the JSTL forEach for your iteration, or stick with the Struts tags.

However, I'm going to move this to the Struts forum where those who are more familiar with the proprietary tags may have some advice for you.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic