gomes
gomes

Reputation: 225

Struts 2 map type conversion

In my jsp I have the a textfield: <s:textfield name="codePropertyMap[%{#codeProperty.id}]" /> where the codePropertyMap is a Map<CodeProperty, String> in my action.

Now, I want to convert the codeProperty.id to a concrete CodeProperty, to do that I created a CodeAction-conversion.properties file with the following text:

KeyProperty_codePropertyMap=id 
Element_codePropertyMap=java.lang.String 
Key_codePropertyMap=CodePropertyImpl

But only with this is not working.

And in this page there is an example for list conversion Struts Type Conversion but I can't see how it works with maps.

What I want to know is what I am missing or its not possible to do the conversion?

Thanks in advance

Upvotes: 1

Views: 904

Answers (1)

gomes
gomes

Reputation: 225

The way I was trying to do it, I think, is not possible. The way I solved was to create a class that extends StrutsTypeConverter, that do the conversion. For more details about this problem and possible solution you can go were http://www.mail-archive.com/user%40struts.apache.org/msg102474.html

Upvotes: 1

Related Questions