struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Benedict <pbened...@apache.org>
Subject Re: [Struts 1.3] first time use custom converter not working
Date Sun, 04 Oct 2009 01:21:26 GMT
Ever solve this? Are you sure you registered your converter properly?

Paul

On Wed, Sep 23, 2009 at 3:14 AM, senderj <senderj@hotmail.com> wrote:
>
> I have a class Stk with property warType of type enum WarrType
>
>    public enum WarrType {
>        NONE, CALL, PUT; }
>
> I have in my struts config
>
> <form-bean name="MyForm"
> type="org.apache.struts.validator.DynaValidatorForm">
> <form-property name="warType" type="java.lang.String"/>
>
> and in my Action
>
>   MyConverter mc = new MyConverter();
>   ConvertUtils.register(mc, WarrType.class);
>   PropertyUtils.copyProperties(stk, form);
>   ......
> and embedded in the Action class
>
>   public class MyConverter implements Converter {
>   @Override
>   public WarrType convert(Class c, Object s) {
>        WarrType result = null;
>         System.out.println("I am running");
>         if (s.equals("NONE")) result = WarrType.NONE;
>        return result; ....
>
> The problem is the convert() never executed. the copyProperties failed with
> "...had String ... expect WarrType...". Any idea why?
>
> --
> View this message in context: http://www.nabble.com/-Struts-1.3--first-time-use-custom-converter-not-working-tp25531027p25531027.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message