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
Bhola VishwakarmaBhola Vishwakarma 

Error VisualforceArrayList.name

Error 'VisualforceArrayList.name'

 

<apex:page controller="MyController22">

    <apex:pageBlock title="Retrieving Query String Parameters">

        You are viewing the {!account.name} account.

    </apex:pageBlock>

    </apex:page>

Shashikant SharmaShashikant Sharma

Check in your controler is

 

account is list of account records

 

please share your controller.

Bhola VishwakarmaBhola Vishwakarma

this is my controller

 

public class MyController22 {
public List<Account> getAccount() {

        return [SELECT id, name FROM Account

                WHERE id = :ApexPages.currentPage().getParameters().get('id')]

  }
}

Shashikant SharmaShashikant Sharma

Changeyour controller like this

 

 

public class MyController22 {
public Account getAccount() {
   
        List<Account> listAcc = [SELECT id, name FROM Account
                     WHERE id = :ApexPages.currentPage().getParameters().get('id')];
        return listAcc.get(0);
  }
}

 

 

Rahul S.ax961Rahul S.ax961

Try this:

 

 

public class MyController22 
{
	Account objAccount
	{	get;set;	}
	public MyController22() 
	{
		 objAccount =  [SELECT id, name FROM Account WHERE id = :ApexPages.currentPage().getParameters().get('id')]
	}
}

 

<apex:page controller="MyController22">
	<apex:pageBlock title="Retrieving Query String Parameters">
		You are viewing the {!objAccount.name} account.
	</apex:pageBlock>
</apex:page>