无法从tabView调用RequestScoped Bean上的操作方法

时间:2015-09-30 14:18:35

标签: jsf primefaces jsf-2.2

我有一个表单并且在tabView中。我在其中一个选项卡中有两个按钮,它们在RequestScoped bean上调用action方法。但是,未调用操作方法。

search.xhtml:

<h:form>
    <p:inputText id="search-query" value="{searchController.searchQuery}"/>
    <p:commandButton value="#{txt['global.search']}"
                     id="search-button"
                     action="#{searchController.search}"
                     update=":search-results"/>

</h:form>
<h:form id="search-results">
    <p:tabView id="search-results-tab"
                       dynamic="false"
                       cache="false">

                <p:tab id="tab-persons" rendered="#{not empty searchController.persons}">
                    <ui:include src="person-table.xhtml"/>
                </p:tab>
    </p:tabView>
</h:form>

人-table.xhtml

<p:outputPanel styleClass="search-results-paginator">

    <p:commandButton id="personsPrevious" value="Prev" action="#{searchController.personResultPrevious}"/>

    <p:commandButton id="personsNext" value="Next" action="#{searchController.personResultNext}"/>

</p:outputPanel>

SearchController.java

@Named("searchController")
@RequestScoped
public class SearchController {

    private List<PersonDTO> persons;        
    private String searchQuery;        

    public String search() {

        persons = searchService.search(searchQuery);
        return null;

    }

    public String personResultNext() {

        loadPersons(searchQuery, ++personResultPage);
        return null;

    }

    public String personResultPrevious() {

        if(personResultPage - 1 > 0) {
            loadPersons(searchQuery, --personResultPage);
        }

        return null;
    }

}

我做错了什么?我没有看到任何错误。

0 个答案:

没有答案