I wrote a converter to convert a enum for BeanUtils.copyProperties(). I have this in my struts config:
<form-bean name="MyForm" type="org.apache.struts.validator.DynaValidatorForm"> <form-property name="warType" type="java.lang.String"/> Here is my converters (embedded class in my Action) public class MyConverter1 implements Converter { @Override public WarrType convert(Class c, Object s) { Object result = null; String ss = (String) s; if (c.getSimpleName().equals("WarrType")) { System.out.println(ss); if (ss.equals("NONE")) result = WarrType.NONE; if (ss.equals("CALL")) result = WarrType.CALL; if (ss.equals("PUT")) result = WarrType.PUT; } return (WarrType) result; } } and here is the code in my Action: MyConverter1 mc1 = new MyConverter1(); ConvertUtils.register(mc1, WarrType.class); BeanUtils.copyProperties(stk, form); I've ensured both Stk and form have the same name "warType". But the copyProperties() takes care of all other properties, except the warType! I have another converter for a date properties coded in similar way and it works. Only this warType doesn't. I have checked the convert() method in MyConverter in debug mode and it can convert correctly. But the stk.warType was not set (although its setWarType() was run with correct parm and output). But if I add this code after the copyProperties() at the above, then it works BeanUtils.copyProperty(stk, "warType", PropertyUtils.getSimpleProperty(form, "warType")); Any idea why? -- View this message in context: http://www.nabble.com/-Struts-1.3--converter-converts-but-not-set-property-tp25531070p25531070.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