Vita Rara: A Life Uncommon

Maps and Struts 2

Hi Phil,

I understand what you meant now. I tried using the VRContext, which extends HashMap, as a property of my action and letting OGNL fill in the values. The problem I ran into was that all of the properties ended up being String[]. The type conversion didn't work. I think there is a way to tell OGNL what the type of a property should be, but just using a first class bean seemed easier.

I've simplified the marshaling of the data to and from the VRContext using a helper method that copies all properties of a bean to a Map. That was a simple two liner in Groovy.

Mark

Reply

Please solve the math problem above and type in the result. e.g. for 1+1, type 2
  • Allowed HTML tags: <a> <img> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <h1> <h2> <h3>
  • Lines and paragraphs break automatically.
More information about formatting options