Problem with outjecting object
skoropada Aug 20, 2009 11:52 PMHi everybody,
I've seam component named resultsAction in which I use @In and @Out annotations I have entity B_property as well.
When I selected one row from properties list on the page I've exception like this:
Caused by: java.lang.IllegalArgumentException: Could not set field value by reflection: ResultsAction.activeProperty on: pl.skoropada.components.ResultsAction with value: class [Ljava.lang.Object;
I've found temporary solution for this by changing type of activeProperty to Object but I don't know where the reason is.
Here is my component:
@Name(value = "resultsAction") @Scope(ScopeType.SESSION) public class ResultsAction { ... @In(required = false) private Bn_property property; @DataModel private List<Bn_property> properties; @DataModelSelection @Out(required = false) private Bn_property activeProperty; ...
and here is part of my xhtml's file (results.xhtml):
<rich:dataList var="prop" value="#{properties}"> <h:column>#{prop[3]} </h:column> <h:column>#{prop[3]} </h:column> <h:column><h:commandLink action="#{resultsAction.view}" value="#{prop[4]}" /></h:column> </rich:dataList>
The second question (less important right now) is why I have to refer to prop[n], where n belongs to 0..N instead of prop.name ?
When I changed to getter's style I had exception like this one;
Caused by: javax.faces.FacesException: javax.el.ELException: /UC0001/results.xhtml: For input string: "id"
so I have to use prop[0] for example.
Entity class here:
@Name(value = "property") public class Bn_property implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(unique=true, nullable=false) private int id; public int getId() { return this.id; } public void setId(int id) { this.id = id; } private String name; public String getName() { return this.name; } public void setName(String name) { this.name = name; }
Can you help me with this ?