List list = (List)request.getAttribute("list") only returns a max of 100 items | Community
Skip to main content
Level 6
October 16, 2015
Solved

List list = (List)request.getAttribute("list") only returns a max of 100 items

  • October 16, 2015
  • 7 replies
  • 1825 views

I have adapted the   List component to count a number of pages from a list of recipe pagescreated by authors under /content/en/all-recipes

 

I start to count how many pages sit under /content/en/all-recipes as follows

 

    %><cq:include script="init.jsp"/><%
    Integer pageCounter = 0;
    List list = (List)request.getAttribute("list");

    if (!list.isEmpty()) {
        int z = list.size();
        list.size() returned a correct count of the number of recipes I had until I reached a number of recipes > 100. Now I have 170 recipe pages and count is still 100.

 

I tested in CRXDE lite how many pages there is using

SELECT * FROM [cq:Page] AS s WHERE ISDESCENDANTNODE(s,'/content/en/all-recipes')

Regards

Clive Stewart

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by edubey

Here are good documentation link:

Its always recommended to write these code in your java classes rather than in JSP

7 replies

Level 6
October 16, 2015

Thank you,

Level 6
October 16, 2015

Thank you, I do prefer to use the Java in OSGI, it is also much easier to debug.

smacdonald2008
Level 10
October 16, 2015

I would recommend any time you require a front end component to display nodes/props/ any type of result set - write a custom Java service (using Java APIs - ie JCQ-SQL2 or QuerytBuilder) and use the front end logic for presentation. IMHO - front end is not as good as back end Java APIs for querying JCR data. However - using JS logic - you can make front end component look very good at displaying JCR data. 

edubey
edubeyAccepted solution
Level 10
October 16, 2015

Here are good documentation link:

Its always recommended to write these code in your java classes rather than in JSP

Level 6
October 16, 2015

I had thought of that, I have only queried the JCR using SQL 2 from an OSGI bundle which I learn t from the AEM tutorials .

 

I have never tried it directly inside of JSP as I do not know which classes I should use / import to run a SQL 2 query inside of JSP. If there is any documentation or example of how to do this inside a jsp I would greatly appreciate it. If not I will use an OSGI bundle.

Regards

Clive Stewart

smacdonald2008
Level 10
October 16, 2015

Why not create your own component that uses JCR SQL2/QueryBuilder to query the JCR nodes and return to the front end component. You did use that in CRXDE lite:

SELECT * FROM [cq:Page] AS s WHERE ISDESCENDANTNODE(s,'/content/en/all-recipes')

Using these Java APIs will improve your result set. 

edubey
Level 10
October 16, 2015

As far as OOTB List component is concerned, I think It will only return pages which are immediate child pages not all child pages.

Example in geometrixx media:-

Taking /content/geometrixx-media/en as parent path, count of child pages will be 5