Created
February 3, 2013 18:50
-
-
Save nazartm/4703114 to your computer and use it in GitHub Desktop.
Simple datatable in JSF with a managed bean.
This file contains 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
<h:dataTable value="#{myBean.books}" var="book"> | |
<h:column> | |
<f:facet name="header">Title</f:facet> | |
#{book.title} | |
</h:column> | |
<h:column> | |
<f:facet name="header">Author</f:facet> | |
#{book.author} | |
</h:column> | |
<h:column> | |
<f:facet name="header">Released</f:facet> | |
<h:outputText value="#{book.releaseDate}" > | |
<f:convertDateTime dateStyle="medium" /> | |
</h:outputText> | |
</h:column> | |
</h:dataTable> |
This file contains 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
@ManagedBean | |
@RequestScoped | |
public class MyBean { | |
private List<Book> books; | |
@PostConstruct | |
public void init() { | |
//retrieve books. | |
} | |
public List<Book> getBooks() { | |
return books; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment