apex:outputlink tag

apex:outputlink tag : In our previous Salesforce Tutorial we have learned about <apex:commandlink> tag. In this Salesforce Training Tutorial we are going to learn about <apex:outputlink> tag and how this tag works when used in visualforce page.

<apex:outputlink>:– apex:outputlink tag is used to create URL which redirects to external website or any other URL. We have to insert hyperlink text to use hyperlink. Hyperlink text is that which displays and the Hyperlink is that which is inserted to hyperlink text that redirects to any other external URL.

Different attributes supported by <apex:outputlink> tag.


Let us see how apex:outputlink tag works.

Create apex:outputlink visualforce page as shown below.

Visualforce apex:outputlink tag

Click on Create page apexoutputlink to create new Visualforce page.

Visualforce apex:outputlink tag

Enter the code as  shown below.

Visualforce apex:outputlink tag

  • Standardcontroller = account.
  • To remove headers like tab menu and sidebar in VF page use showHeader=”false”.
  • Use pageblock tag for inserting Header for the VF page usually H1.
  • In pageblocksection only we have to to <apex:outputlink> tag. Value will be the Hyperlink and the text before closing tag of </apex:outputlink> is the hyperlink text.

apex:outputlink tag Output

Visualforce apex:outputlink tag