[
https://issues.apache.org/struts/browse/WW-2158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
James Holmes updated WW-2158:
-----------------------------
Fix Version/s: 2.0.11
> Incorrect binding of superclass fields when mapping from view (JSP) to Struts
> Actions
> -------------------------------------------------------------------------------------
>
> Key: WW-2158
> URL: https://issues.apache.org/struts/browse/WW-2158
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.0.9
> Reporter: Andres Montes
> Fix For: 2.0.11
>
>
> When inherited classes are used as attributes of Struts Actions the binding
> of parameters from view to actions is not working properly. In fact,
> reflection is not able to map attributes from superclass, they are ignored,
> and mapped as not found on the retrieved result. For example:
> public abstract class BaseType implements Serializable {
> Long id;
> // getters and setters ...
> }
> public class TypeA extends BaseType implements Serializable {
> String name;
> // getters and setters ...
> }
> public class Item implements Serializable {
> String name;
> TypeA itemType;
> // getters and setters ...
> }
> public class ItemCrudAction extends ActionSupport implements Preparable {
> private Item myItem;
> // getters and setters ...
> // methods to populate data into view ...
> public void execute() {
> // Retrieve attribute from View (JSP):
> Item itemFromView = getMyItem(); // --> Here the compiler, through
> reflection, shows the following attributes:
> // name (of type String) -correct-
> // Relationship attribute TypeA with the following attributes:
> // From superclass BaseType: id (of type String[1] instead of
> Long) - incorrect-
> // I guess this is because it can't find the attribute on the class
> // From class TypeA: name (of type String) - correct-
> }
> // item.jsp
> // ...
> <s:textfield key="myitem.name" size="50" maxlength="2/>
> // Combobox with values of type TypeA
> // listOfValuesOfTypeA are filled from ItemCrudAction
> <s:select key="myItem.itemType.id" list="listOfValuesOfTypeA"
> headerKey="-1" headerValue="-- Select value --" />
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.