Not a bug. It doesn't work with sets. Ui:repeat should, though.
The problem lies in datatable requiring a position, or index, so it can
determine the selected row.... file it as an enhancement on the spec issue
tracker (www.javaserverfaces.org ) . I think it's a poor limitation.
Lincoln
Lincoln Baxter III
http://ocpsoft.com
http://scrumshark.com
Keep it simple.
On Dec 25, 2009 5:10 AM, <webtier_at_javadesktop.org> wrote:
Hi,
I wanna use the h:dataTable with a java.util.Set as list value like this:
Bean:
@ManagedBean
@RequestScoped
public class MyBean {
private Set<MyDomain> myDomains;
public MyBean() {
myDomains = new LinkedHashSet<MyDomain>();
myDomains.add(new MyDomain("1", "eins"));
myDomains.add(new MyDomain("2", "zwei"));
myDomains.add(new MyDomain("3", "drei"));
myDomains.add(new MyDomain("4", "vier"));
}
public Set<MyDomain> getMyDomains() {
return myDomains;
}
public void setMyDomains(Set<MyDomain> myDomains) {
this.myDomains = myDomains;
}
}
h:dataTable
<h:dataTable value="#{myBean.myDomains}" var="i">
<h:column>
<h:outputText value="#{i.key}" />
</h:column>
<h:column>
<h:outputText value="#{i.value}" />
</h:column>
</h:dataTable>
I get the following exception:
javax.el.PropertyNotFoundException: /index.xhtml @11,37 value="#{i.key}":
Property 'key' not found on type java.util.LinkedHashSet
at
com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:104)
at
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:190)
at
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:178)
at javax.faces.component.UIOutput.getValue(UIOutput.java:168)
BTW with java.util.List everything works fine!
Any ideas?
Is that a bug (IMO it must be ;-))
Alex
[Message sent by forum member 'alexander_bell' (Alexander.Bell_at_j4fry.org)]
http://forums.java.net/jive/thread.jspa?messageID=377473
---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net