• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Struts2: use a property as key in a jsp

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Here is my problem:

I have a map "listeRessources.map" in a jsp, I can get a value with a key like this:

<s:property value="listeRessources.map['idconcept']" /> prints Oeuvre224

I have a property file from which I can get the value idconcept:

ID_CONCEPT=idconcept

so in the jsp <s:text name="ID_CONCEPT"/> prints idconcept

I would like to get the value of the key using the property file, I tried

<s:property value="listeRessources.map[<s:text name='ID_CONCEPT'/>]"

but it does not work.

Can you help me please?

thanks

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess you want to print value and key from map


you may need to convert it to tags you are using >< s : your_iterate_tag >
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Shilpa: Struts 2.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Keys shouldn't really be in property files in my opinion, but I'd say the easiest way would be to do a bit more work on the server side.

Obviously you can't nest custom tags like that, but you might also be able to set a JSP var with the value and access it via OGNL.
 
Do the next thing next. That’s a pretty good rule. Read the tiny ad, that’s a pretty good rule, too.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic