function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Can someone explain the working of <li> and <apex:repeat> w.r.t. the below code?

<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock title="Accounts">
        <apex:repeat value="{!Accounts}" var="a">
                <apex:outputLink value="/{!}">{!a.Name}</apex:outputLink>


output of VF- standard list controller
Alex Bondarenko 1Alex Bondarenko 1


apex:repeat is just like loop operator FOR and the HTML <li> tag represents a list item in ordered and unordered lists.

thus, it is the same like in Apex code

List<Account> accList  // colection of account objects
for( Account a : accList) {
    system.debug('Account Name: ' + a.Name);
Ajay K DubediAjay K Dubedi
Hi Newbie999,
The HTML <li> element is used to represent an item in a list. It must be contained in a parent element: an ordered list (<ol>), an unordered list (<ul>), or a menu (<menu>). In menus and unordered lists, list items are usually displayed using bullet points. In ordered lists, they are usually displayed with an ascending counter on the left, such as a number or letter.

For more details refer the below link:

apex:repeat : 

An iteration component that allows you to output the contents of a collection according to a structure that you specify. The collection can include up to 1,000 items.

Link for apex:repeat :

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Ajay Dubedi