Ok that clears things up.  I'll sit down and try to write this down now. 
Thanks for all the help guys!
GB


cilquirm wrote:
> 
> Doesn't seem that way.
> One converts a single string value to an enum, and the other converts a
> String[] to a List<Enum>
> 
> I just checked it over and it's not directly useable because it's a type
> converter for a specific enum ( OperationsEnum ), but the principles
> apply.
> 
> The long and the short of is that you'll have to write your own type
> converter, but checking out the example from showcase is a fairly good
> starting point that should get you at least halfway.
> 
> hth,
> -a
> 
> 
> Guillaume Bilodeau wrote:
>> 
>> So you're saying that the showcase EnumTypeConverter isn't the same as
>> the one provided in XWork2?
>> 
>> 
>> cilquirm wrote:
>>> 
>>> Indeed, the problem is that EnumTypeConverter, as provided by Struts2 
>>> only works for single values.
>>> 
>>> Can you make selectedNutrients a List?
>>> 
>>> If so, you might be able to use the EnumTypeConverter from the showcase
>>> app, or roll your own based off it, which isn't that hard at all.
>>> 
>>> org.apache.struts2.showcase.conversion.EnumTypeConverter
>>> 
>>> hth,
>>> -a
>>> 
>>> 
>>> 
>>> Guillaume Bilodeau wrote:
>>>> 
>>>> Yes I tried that, with no success unfortunately.
>>>> 
>>>> Somehow we need to specify that:
>>>> 1- selectedNutrients[] will need to be mapped to an array of Nutrients
>>>> 2- each element of selectedNutrients[] must be mapped using
>>>> EnumTypeConverter
>>>> 
>>>> 
>>>> cilquirm wrote:
>>>>> 
>>>>> Are enums type-converted automatically now?
>>>>> 
>>>>> I recall early on I  had to specify
>>>>> http://struts.apache.org/2.0.9/struts2-core/apidocs/com/opensymphony/xwork2/util/EnumTypeConverter.html
>>>>> 
>>>>> Have you tried specifying that?
>>>>> 
>>>>> with 
>>>>> 
>>>>> Element_selectedNutrients =
>>>>> com.opensymphony.xwork2.util.EnumTypeConverter
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Mapping-multiple-enums-to-a-nested-object-tf4505238.html#a12886927
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to