Apex Controller:
public class TestApexDetail { public Id AccountId {get;set;} public TestApexDetail() { Account objAC = [SELECT Id From Account LIMIT 1]; AccountId = objAC.Id; } }
Visualforce Page:
<apex:page controller="TestApexDetail"> <apex:form> <apex:detail subject="{!AccountId}" relatedlist="false"></apex:detail> </apex:form> </apex:page>
Output: