Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8418661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:23:29+00:00 2026-06-10T02:23:29+00:00

I am developing a Portlet with Liferay (using liferay-ui in the JSP) and SpringMVC.

  • 0

I am developing a Portlet with Liferay (using liferay-ui in the JSP) and SpringMVC.

I have the following code in my JSP:

<liferay-ui:search-container delta="5" emptyResultsMessage="no books!">
  <%
    List<Book> bookList = (List<Book>)request.getAttribute("bookList");
    List<Book> bookListView = ListUtil.subList(bookList, searchContainer.getStart(), searchContainer.getEnd());
  %>
<liferay-ui:search-container-results results="<%= bookListView %>" total="${numberOfBooks}">

</liferay-ui:search-container-results>
  ...

I’d really like to get rid of the Java Code Block in the JSP and have the bookListView as model attribute just like numberOfBooks in the above code.

However, I can’t find a way to access searchContainer from the Spring Controller to get the start and end of the pagination…

Any ideas? Thx!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:23:30+00:00Added an answer on June 10, 2026 at 2:23 am

    This might work for you:

    SearchContainer<Book> searchContainer = new SearchContainer<Book>(renderRequest, renderResponse.createRenderURL(), null, "there are no books");
    

    Or else,

    You can get the parameters from request: delta=20 & cur=2

    where cur is the current page which is requested and delta is the total number of items on a page.

    With this you can calculate the start (0,20,40, …) and end (19,39,59, …) as does liferay’s SearchContainer with this method:

    private void _calculateStartAndEnd() {
        _start = (_cur - 1) * _delta;
        _end = _start + _delta;
    
        _resultEnd = _end;
    
        if (_resultEnd > _total) {
            _resultEnd = _total;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a liferay portlet. Here is my code in jsp file: <table class=DDGridView>
Hi i am developing Liferay faces portlet in Liferay 6.0.6 portal + 6.1 Plugins
There is a guide on the Liferay site Developing a Portlet with Multiple Actions
I'm developing (trying for now) portlet that will be integrated with LinkedIn. Following the
I started developing a portlet based application using WebSphere Portal and now I am
I'm developing a JSF 2.0 portlet for Liferay 6.0.6 (Plugins SDK 6.1) and I
I'm developing a portlet for Liferay 6.1. At some point I'm evaluating input from
I am developing a portlet where I have Hibernate access to SQL Server database.
I'm developing a portlet for WebSphere Portal 6.1, with JSP/JSTL, pure javascript, no AJAX
I am developing Liferay portlet. The portlet should load xml file from same server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.