JSF:没有找到记录时清除DataTable?

时间:2015-09-28 15:24:38

标签: jsf jsf-2 richfaces

我有一个奇怪的问题。我有一个搜索条件,我有一个显示结果的数据表。

搜索功能正常。以下是问题。

我输入一些搜索条件,点击搜索按钮,显示记录。精细。 我再次输入一些搜索条件,其中没有记录数据表应该被清除。但问题是旧记录本身正在显示。可能是什么问题

以下是我的java代码:

local f = io.open("somefile", "w")
f:write("some long text")
f:close()

local f = io.open("somefile", "r+")
f:write("new content")
f:close()

JSF:

public void results(TestItem[] TestItemTOArray, TestForm TestForm, boolean isNewSearch, CarService carService) throws Exception {
        if (viewBean instanceof TestViewBean) {
            TestViewBean = (TestViewBean) viewBean;
        }
        TestRowForm[] TestRowFormArray = this.convertToTestRowForm(TestItemTOArray, TestForm, isNewSearch, carService);
        if(TestRowFormArray.length > 0)
            TestForm.setTestRowForm(TestRowFormArray);
        if(TestRowFormArray!=null){ 
            TestForm.setTestRowForm(TestRowFormArray);
            TestForm.setTotalRows(TestRowFormArray.length);
        }
    }

1 个答案:

答案 0 :(得分:0)

如果结果集也为空,则应清理数据表的数据源。