struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxx <>
Subject Re: Unable to make Type Conversion work in Struts2
Date Tue, 19 Feb 2008 10:11:25 GMT
Thanks for your answer.

I partially fixed this, noticing the square brackets notation is the
same for Lists and Maps, which is not so clear on the related doc page
(I posted a comment about this, having had a conversion with Dave
Newton about this in a more recent thread on the mailing-list), as
well as fixed the getter method which had a bad copy/paste issue.

But I found another problem that might need some better formulation
from me, and eventually a Jira: it seems Struts2 isn't able to fully
support the java.lang.EnumMap object (e.g. using a EnumMap<YourEnum,
String>), given that it's a particular Map (i.e. all keys are known,
and they are NOT Strings) without any no-arg constructor - thus
resulting in some cases in an InstanciationException.

I tried some work-around with the introduction of an
"EnumTypeConverter" (extending StrutsTypeConverter), which seemed to
work fine at first sight, but unfortunately there's a buggy side
effect: Struts2 then tried to convert the input value (which has to be
the "value" of the map of type java.lang.String, if referring to the
above example) ... in the corresponding Enum type of the key!!!
Even if its declared in the <youraction> with:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message