The power of the List component

In this blog­post I will demon­strate the power of the List com­po­nent in com­bi­na­tion with Sling.

Almost every time when you have the require­ment “to show a list of …” you can use the List com­po­nent. The list com­po­nent saves you the has­sle of writ­ing the plumb­ing code around get­ting a list of pages, loop­ing and pagination.

The goal of this exam­ple is to ren­der a list of ‘page-teasers’ with a Read more link to go to that page.

All of this will be imple­mented *with­out* writ­ing any Java-code.

I have very sim­ple page-component (extend­ing foundation/components/page) with this in the body.jsp