Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 分页数据表不';不要在下一页显示任何记录_Java_Jsf_Primefaces_Datatable_Spring Security - Fatal编程技术网

Java 分页数据表不';不要在下一页显示任何记录

Java 分页数据表不';不要在下一页显示任何记录,java,jsf,primefaces,datatable,spring-security,Java,Jsf,Primefaces,Datatable,Spring Security,我有一个分页的数据表:使用rows=7正确加载和显示前7项;但是,当我们单击链接查看下一组元素时,会显示“未找到记录” 对于表尾模板,我们使用了 In total there are #{fn:length(deviceBean.devices)} devices. 这向我们(找到11项)表明,在所有这些项目中,有更多的项目需要显示 我做错了什么 下面是xhtml文件代码: <f:view xmlns="http://www.w3.org/1999/xhtml"

我有一个分页的数据表:使用
rows=7
正确加载和显示前7项;但是,当我们单击链接查看下一组元素时,会显示“未找到记录”

对于表尾模板,我们使用了

     In total there are #{fn:length(deviceBean.devices)} devices. 
这向我们(找到11项)表明,在所有这些项目中,有更多的项目需要显示

我做错了什么

下面是xhtml文件代码:

    <f:view xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions">

    <h:head />


    <h:form>
        <p:growl id="messages">
            <p:toolbarGroup align="right">
                <p:commandButton type="button" value="Summary" />
                <p:separator />
            </p:toolbarGroup>
        </p:growl>
    </h:form>

    <h:form>



        <p:dataTable id="tbl1" var="searchvalue"
            value="#{searchBean.searchmodel}" rows="1">
            <p:column>

                <f:facet name="header">
                    <h:outputText value="Search Criteria" />
                </f:facet>
                <h:outputText value="By State Name" />
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Search Input" />
                </f:facet>
                <h:outputText value="#{searchvalue.criteria}" />
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Selected Model" />
                </f:facet>
                <h:outputText value="#{searchvalue.model}" />
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Start date" />
                </f:facet>
                <h:outputText value="#{searchvalue.startdate}" />
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="End date" />
                </f:facet>
                <h:outputText value="#{searchvalue.enddate}" />
            </p:column>
            <!-- <p:column>
                <f:facet name="header">
                    <h:outputText value="Age Range" />
                </f:facet>
                <h:outputText value="#{searchvalue.agerange}" />
            </p:column> -->

        </p:dataTable>
    </h:form>
<p:spacer width="100" height="10" /> and <p:spacer width="20" height="20" />
<h:outputText value="&#160;" />
    <h:form>

        <h:form>
            <p:growl id="messages">
                <p:toolbarGroup align="right">
                    <p:commandButton type="button" value="Detail:" />
                    <p:separator />
                </p:toolbarGroup>
            </p:growl>
        </h:form>

        <p:dataTable id="tbl" var="device" value="#{deviceBean.devices}"
            paginator="true" rows="7">
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Name" />
                </f:facet>
                <h:outputText value="#{device.name}" />
            </p:column>

            <p:column>
                <f:facet name="header">
                    <h:outputText value="Email" />
                </f:facet>
                <h:outputText value="#{device.email}" />
            </p:column>


            <f:facet name="footer">  
            In total there are #{fn:length(deviceBean.devices)} devices.  
          </f:facet>

        </p:dataTable>

        <br />


    </h:form>

</f:view>

及
总共有#{fn:length(deviceBean.devices)}个设备。

下面是托管bean类:

@ManagedBean
@ViewScoped
public class SearchBean implements Serializable {

    HttpServletRequest request = (HttpServletRequest) (FacesContext.getCurrentInstance().getExternalContext().getRequest());
    private List<SearchModel> searchmodel = (List) request.getAttribute("search_attributes");

    public List<SearchModel> getSearchmodel() {
        return searchmodel;
    }

}
@ManagedBean
@视域
公共类SearchBean实现了可序列化{
HttpServletRequest=(HttpServletRequest)(FacesContext.getCurrentInstance().getExternalContext().getRequest());
私有列表searchmodel=(List)request.getAttribute(“search_attributes”);
公共列表getSearchmodel(){
返回搜索模型;
}
}

@BalusC:不,我没有使用spring security之外的任何东西,我不是通过spring管理beans,我可以解释它是如何工作的:在spring security的安全认证之后,控件进入welcom.jsp页面,在这个页面中,我使用了
作为初学者,您没有在这里显示任何代码是错误的,不告诉我们您使用的primefaces的版本等。没有任何信息,没有人能够帮助您亲爱的kolossus我已经更新了我的查询,谢谢您的建议。没有人可以帮助我吗。虽然您在这里发布的内容没有明显的错误,但问题主要在于您的自定义数据模型。
searchModel
实现了什么?在load方法中添加一些调试行,以显示在分页操作期间实际返回了行。我从summary managed bean调用了我的DAO,并重新设计了我的managed bean it,它现在可以工作了,谢谢:)
HttpServletRequest request = (HttpServletRequest) (FacesContext.getCurrentInstance().getExternalContext().getRequest());
    private List<SearchModel> searchmodel = (List) request.getAttribute("search_attributes");

    public List<SearchModel> getSearchmodel() {
        return searchmodel;
    }