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]