How to check list size in Visualforce page

The following is the way to check list size in visual force page;

Visualforce Page

<apex:page controller=”passingParamActionFuncController”>
<apex:form >
<apex:pageBlock title=”Account Information” id=”pb”>
<apex:pageBlockSection >
<apex:inputField value=”{!account.Type}” Onchange=”displayAccount();”/>
<apex:actionFunction name=”displayAccount” action=”{!displayAccount}” reRender=”panel,mess”/>
<apex:outputPanel id=”panel”>
<apex:pageMessages id=”mess”></apex:pageMessages>

<apex:pageBlockTable value=”{!listOfAccounts}” var=”account” rendered=”{! IF(ISBLANK(listOfAccounts), false, true) }”>

<apex:column value=”{!account.Name}”/>
<apex:column value=”{!account.Type}”/>
</apex:pageBlockTable>

</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

</apex:page>

Controller

public with sharing class passingParamActionFuncController {

public Account account { get; set; }

public list<Account> listOfAccounts{get;set;}

public passingParamActionFuncController(){
account = new Account();
}

public PageReference displayAccount() {
System.debug(‘Printing account–>’+account.Type);
listOfAccounts = [SELECT id,Name,Type
FROM Account
WHERE Type =:account.Type];

if(listOfAccounts.size() == 0){
Apexpages.addMessage(new ApexPages.message(ApexPages.Severity.Info,’No Accounts Present in this Type’));
}
return null;
}

}

 

Another Way;

<apex:pageBlockTable value=”{!listOfAccounts}” var=”account” rendered=”{! IF(listOfAccounts.size>0, true, false) }”>