Sample Code:
Visualforce page:
Visualforce page:
- <apex:page controller=“Sample”>
- <apex:form >
- <h1>Below is the Account detail</h1>
- <apex:detail subject=“{!AccountId}” relatedList=“false”/>
- </apex:form>
- </apex:page>
Apex Controller:
- public class Sample {
- public Id AccountId {get;set;}
- public Sample() {
- AccountId = ‘0019000001BoVNx’;
- }
- }
Output:
One Question:
When we use this tag, it is showing all the available Account fields.
But if I want to display only specific fields like Account Name, Phone, Fax and website on the page, then how we can achieve this.
Use apex:outputField. You can find an example – http://www.infallibletechie.com/2015/04/what-is-difference-between-outputfield.html
It is showing that
content is not allowed in trailing section
If you are trying to show XML content, check the content of the XML. Make sure the content is correct.