【问题标题】:<liferay-ui:search-container> scriplets<liferay-ui:search-container> 脚本
【发布时间】:2016-09-01 14:49:06
【问题描述】:

我怎样才能在这里摆脱 scriplets?

<liferay-ui:search-container>
    <liferay-ui:search-container-results
        results="<%= BookLocalServiceUtil.getBooks(searchContainer.getStart(), searchContainer.getEnd()) %>" 
        total="<%= BookLocalServiceUtil.getBooksCount() %>"
/>

【问题讨论】:

    标签: liferay jstl el scriptlet


    【解决方案1】:

    我找到了解决办法!

    在.jsp中

    <liferay-ui:search-container> <liferay-ui:search-container-results results="${bookListArray}" />
    

    render方法中:

        String pageName = request.getParameter("pageName");
        List<Book> bookList = null;
        try {
            bookList = BookLocalServiceUtil.getBooks(QueryUtil.ALL_POS, QueryUtil.ALL_POS);
        } catch (SystemException e1) {
            e1.printStackTrace();
        }
        request.setAttribute("bookListArray", bookList);
    

    【讨论】:

    • 只是一个建议:小心那些 QueryUtil.ALL_POS。如果您只有几条记录,那没关系,但对于大量数据,这将是一个非常糟糕的主意。在您的请求中发送开始和结束,并将它们传递给您的服务调用以检索一组记录。
    • 谢谢你,@JuanManuelRogado !
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-23
    • 1970-01-01
    • 2015-10-03
    • 2013-04-16
    • 1970-01-01
    • 2016-05-22
    相关资源
    最近更新 更多