我想用最后检查的数据库的角色填充角色数据表。我该如何实施?
public class Database implements Serializable {
private List<Role> roles;
private String name;
private boolean selected;
...
}
public class Role implements Serializable {
private String name;
...
}
data.xhtml看起来像这样
...
<p:dataTable id="databases" var="database" value="#{dataBean.databases}" >
<p:column>
<p:selectBooleanCheckbox value="#{database.selected}">
<p:ajax update="roles, databases" immediate="true" />
</p:selectBooleanCheckbox>
</p:column>
<p:column headerText="Databases">
<h:outputText value="#{database.name}" />
</p:column>
</p:dataTable>
<p:dataTable id="roles" var="role" value="#{dataBean.roles}" >
<p:column headerText="Roles">
<h:outputText value="#{role.name}" />
</p:column>
</p:dataTable>