Created
May 16, 2012 08:00
-
-
Save lukaspili/2708503 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MyController.java : | |
@ManagedBean | |
public class MyController { | |
private DataModel<User> dataModel; | |
public DataModel<User> getDataModel() { | |
if(dataModel == null) { | |
List<User> users = userService.getAll(); | |
dataModel = new ListDataModel(users); | |
} | |
return dataModel; | |
} | |
} | |
// view.xhtml : | |
<h:datatable value="#{myController.dataModel}" var="u"> | |
<h:column> | |
<f:facet name="header"> | |
Firstname | |
</f:facet> | |
#{u.firstname} | |
</h:column> | |
<h:column> | |
<f:facet name="header"> | |
Lastname | |
</f:facet> | |
#{u.lastname} | |
</h:column> | |
</h:datatable> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment