Are there any workarounds for this? I've tried using a conversion properties file for my action and adding the following: id=example.MyTypeConverter
but it didn't get called from struts. I wonder if it's because it should be model.id or myobject.id. Carlos Luis Zúñiga Sibaja wrote: > > Actually, this is a problem in OGNL, because the version bundled with > Struts > 2.1.2 cannot handle objects with generifyed properties. This definitively > sucks since it prevents a lot of code reuse, in my specific experience I > had > a similar implementation for a base ModelObject and an AbstractCrudAction > but because of this error, it is not possible to generify these objects. > > There is already a Jira issue about this situation: > https://issues.apache.org/struts/browse/WW-2128 > > Regards, > > Carlos Luis Zúñiga Sibaja > __________________________ > [EMAIL PROTECTED] > > divide et impera... > > > On Wed, Nov 12, 2008 at 11:31 PM, Adam Ruggles <[EMAIL PROTECTED]> > wrote: > >> >> I'm trying to figure out why struts/xwork is having issues doing the >> conversion on an Integer property. Here is the configuration. >> >> public class MyAction extends ActionSupport implements Preparable, >> ModelDriven<MyObject> { >> private MyObject obj; >> public void prepare() throws Exception { >> obj = new MyObject(); >> } >> public MyObject getModel() { >> return obj; >> } >> public String execute() { >> // MyObject.id is not set, although ever other field is fine. >> } >> } >> >> public interface CoreEntity<ID extends Serializable> { >> ID getId(); >> void setId(ID id); >> } >> >> public class MyObject implements CoreEntity<Integer> { >> private String description; >> private Integer id; >> >> public Integer getId() { >> return id; >> } >> public void setId(final Integer id) { >> this.id = id; >> } >> public String getDescription() { >> return description; >> } >> public void setDescription(final String description) { >> this.description = description; >> } >> } >> >> The error I'm getting is >> ognl.MethodFailedException: Method "setId" failed for object >> [EMAIL PROTECTED] Category 2,id=<null>] >> [java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to >> java.lang.Integer] >> >> It looks like it's having an issue with my use of generics in the >> interface, >> but I don't know for sure. Is there any way for me to tell struts2/xwork >> that the id field for the model object is a Integer? >> -- >> View this message in context: >> http://www.nabble.com/Struts-2.1.2-type-conversion-failing-for-Integer-method.-tp20475044p20475044.html >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > -- View this message in context: http://www.nabble.com/Struts-2.1.2-type-conversion-failing-for-Integer-method.-tp20475044p20489006.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]