Hi

On Tue, Apr 15, 2008 at 12:29 PM, Ramanathan RV <[EMAIL PROTECTED]> wrote:
> Hello,
>
>  I wish to display/read value that belongs to an enumerated type. Struts
>  seems to handle Class and Enum differently. For instance,
>
>  *xwork-conversion*
>  
> com.company.utils.Constants.EducationalQualification=com.company.ui.utils.EducationalQualificationConverter
>  java.util.Date=com.loandukaan.ui.utils.DateConverter
>
>  For the date parameter, the converter gets invoked. Whereas, for the type
>  EducationalQualification, the converter doesnt get invoked and the set
>  method in the form bean fails. Any thoughts?

Actually this is xwork-behaviour. It already provides the class
com.opensymphony.xwork2.util.EnumTypeConverter[1], which you can
simply use to convert your Enum:

xwork-conversion.properties:
foo.bar.MyEnumeration = com.opensymphony.xwork2.util.EnumTypeConverter

If you don't like the default behaviour using the Enum name() as
representation in the page, you can always write your own type
converter[2].

Cheers,
-Ralf


[1] 
http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/util/EnumTypeConverter.html
[2] http://struts.apache.org/2.0.11.1/docs/type-conversion.html

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

Reply via email to