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

StandardSetController and Pagination

I have a page with a field for zip codes, that once submitted, will return a pageBlockTable with info. I'm having trouble returning a list once I submit. I'm new to StandardSetController and pagination. Any help would be much appreciated.


Here's my VF:


<apex:form >
	<apex:pageBlock title="Search by Zip">
		<apex:inputText value="{!zips}" />
		<apex:commandButton value="Search" action="{!find}" />
	<apex:pageBlock title="Nearby Company/Branch" rendered="{!zips != null}">
		<apex:pageBlockTable id="accountTable" value="{!accounts}" var="acct">
			<apex:column headerValue="Company/Branch">
				<apex:outputLink value="/{!acct.Id}" target="_top">{!acct.Name}</apex:outputLink>
			<apex:column headerValue="Address" colspan="2">
				<apex:outputText >{!acct.BillingStreet}, {!acct.BillingCity}, {!acct.BillingState}, {!acct.BillingPostalCode}</apex:outputText>
			<apex:column >
				<apex:outputLink value="{!acct.BillingStreet},{!acct.BillingCity},{!acct.BillingState},{!acct.BillingPostalCode}" target="_blank">Get Directions</apex:outputLink>


Here's my controller class:


public with sharing class zipMap {

	public String zips { get; set; }
	public PageReference find() {
		return ApexPages.currentPage();
	public ApexPages.StandardSetController accts {
		get {
			if(accts == null) {
				List<String> zList = zips.split(',');
				accts = new ApexPages.StandardSetController(
						[SELECT Id, Name, BillingStreet, BillingCity, BillingState, BillingPostalCode FROM Account WHERE BillingPostalCode IN : zList ORDER BY BillingPostalCode, Name]
			return accts;
	public List<Account> getAccounts() {
		return (List<Account>) accts.getRecords();
	public Boolean hasNext {
		get { return accts.getHasNext(); }		
	public Boolean hasPrevious {
		get { return accts.getHasPrevious(); }
	public Integer pageNumber {
		get { return accts.getPageNumber(); }
	public void first() { accts.first(); }
	public void last() { accts.last(); }
	public void previous() { accts.previous(); }
	public void next() {; }




Thanks in advance for your help.