You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Obinna <ob...@gmail.com> on 2010/08/10 14:37:26 UTC
Problems with List
I'm using Struts 2.1.8.1, xwork 2.1.6 and Tthere seems to be an issue trying
to populate the fields of a Lis of Maps using OGNL.
In my action I have an action property name 'grid' with appropriate
getters/setters of type ArrayList<HashMap<String,String>> which I want to
populate dynamically from a grid of textboxes.
I am setting my textbox name property to
name="grid[%{#status.index}]['MapKey']" such that the html name properties
resolves to: grid[0]['MapKey'], grid[1]['MapKey'], grid[2]['MapKey'],
etc...
I expect this to dynamically create and populate a new ArrayList with new
HashMap instances and put a 'MapKey' entry in each map with a value equal to
the value of the textfield.
However, I am getting an xwork OGNL error which sys that it is trying to
covert the String 'MakKey' to type 'HashMap' and obviously failing.
The syntax grid[%{#status.index}]['MapKey'] appears correct for what I'm
trying to do, but somehow OGNL is not interpreting the result
of grid[%{#status.index}] as a list entry and the trying to create the new
HashMap instance before populating it.
Is there a different syntax for chain the indexed properties for a List of
Maps?
Thanks,
Strykker