I'm using following simple code to get list of Account via custom controller but it is not returning records.what I'm doing wrong ?
<apex:page controller="listcontroller" >
<apex:Form >
<apex:pagemessages ></apex:pagemessages>
<apex:pageblock >
<apex:pageblockTable value="{!acclist}" var="a">
<apex:column >
<apex:inputField value=" {!a.name}" />
</apex:column>
</apex:pageblockTable>
</apex:pageblock>
</apex:Form>
</apex:page>
my apex code is :
public class listcontroller {
public List<Account> acclist{get;set;}
Public pagereference listcontroller()
{
acclist = [select id, name, industry from account limit 10 ];
return null;
}
}
I was reading this example in salesforce help https://www.salesforce.com/docs/developer/pages/Content/pages_custom_list_controller.htm
and it has made use of standardSet Controller, which seems little complex comparing to what I've written . is its(set controller) usage is necessary in case of custom controller to get list of records?
constructor
method, but by adding a return type and value, it has become a standard controller action. – Caspar Harmer Apr 26 '15 at 7:06