• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Access map value through property of a nested input

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

I am using Struts 1.2.9.

Within the property attribute of a html:text (http://struts.apache.org/tags-html), is there a way to access a property of a POJO defined as a value of a Map in the actionForm?

Example of POJO:

I create it from the action:

The ActionForm aims to be generic.

There is a jsp (myPojo.jsp) associated to the POJO that I can call from the main page:


Is there a way to access "myProperty" from "myPojo.jsp"?

The following code…

…is working but only if I define the corresponding "getter" in GenericForm:

My main issue is to ensure that GenericForm remains generic (no getFoo method).

I thought about a way to dynamically declare the "getters" in "registerPojo" (reflection?) but I don’t know how to do that.

Or maybe is there a syntax I didn’t think about yet?


Thank you, even just for the time you spent reading this.
 
Herbert Lenoir
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried to understand the getNestedProperty of PropertyUtilsBean.java and it seems that the two following syntax should be correct:
I will try again and see what I get. (Though it may take a few hours.)
 
Herbert Lenoir
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It’s working with the following syntax: I didn’t test the other. I must have been confused two weeks ago when I gave up on the problem after three days of trying.

Problem solved. Thanks the community for being there, I may not have found the solution without writing all those posts.
reply
    Bookmark Topic Watch Topic
  • New Topic