Search code examples
liferayjstlelscriptlet

<liferay-ui:search-container> scriplets


How can I get rid of scriplets here?

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

Solution

  • I've found solution!

    In .jsp

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

    In render method:

        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);