HI,

You must create your property as a WarrType.
<form-property name="warType" type="foo.bar.WarrType"/>

Then your converter will be call.


On Sat, Oct 3, 2009 at 10:21 PM, Paul Benedict <pbened...@apache.org> wrote:

> Ever solve this? Are you sure you registered your converter properly?
>
> Paul
>
> On Wed, Sep 23, 2009 at 3:14 AM, senderj <send...@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-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to