galao
galao

Reputation: 1301

dataTable is not updating even refreshing the page

in my xhtml page i have

<h:dataTable value="#{testController.items}" var="item" border="0">
    <h:column>
        <h:outputText value="#{item.name}"/>
    </h:column>           
</h:dataTable>

it correctly displays the list of item names in the database. My problem is, whenever i try to create or delete an item, even tho i hit f5 or refresh the page manually, the items in the data table does not change. it somehow only updates the table when i clear my browser's cache.

public DataModel getItems() {
    if (items == null) {
        items = getPagination().createPageDataModel();
    }
    return items;
}

Upvotes: 2

Views: 1790

Answers (1)

mooonli
mooonli

Reputation: 2393

What scope do you have? Well as it seems from your code, your items won't get loaded again on a refresh, because they are already initialized at this moment. Tray to remove the if-statement and check if the items get reloaded after a refresh then.

Upvotes: 1

Related Questions