apex:page is a Standard Visualforce component. apex:page component is the very important in Visualforce because every Visualforce page will start with this component. This says that a single Visualforce page and all the components must be wrapped inside apex:page component.

Apex:Page Component

apex: page component has some attributes that are used in Visualforce pages. They are

Action

This invokes when this page is requested by the server, here we must use an expression language to reference an action method in APEX. Action= {! do action} —>  Must be defined in Apex class.

Example

 action= {! int} or action= {!redir} —> re directions the page to new page referred —> Initializes

ADVERTISEMENT

Controller

 It’s a string type and the name given here must be implemented in an Apex class, controller means an custom controller, this cannot be used if we use standard controller.

<apex: page Controller=”class name implemented in APEX”>

Extension

This is used to extend the custom controllers we can have any extension for an custom controller, this is used to add extra functionality.

<apex: page controller: “string” extension=”string”>

ID

It’s a string and gives an identification for the components which means this ID recognize the components uniquely. We can specify any name, but it should not be a duplicate, it’s generally used to refer this page by other components in the page.

api version

This indicates the latest version of api.

recordSetVar 

It’s a string; this attribute indicates that the page users a set of records oriented by a standard controller only. Used to handle multiple records, this attribute converts a controller to a list controller.

RenderAs

 It’s a string the name of any supported content converter, we can change the display in to a ‘PDF’ or another type currently it’s only a ‘PDF’ format. <apex: page render as=’PDF’> displays a page in a pdf format.

Rendered

 It’s a Boolean type, related to the displaying of a page by default it’s a ‘TRUE’, if we keep it false the page will not be displayed.

Setup

It’s a Boolean type; it specifies whether the page should implement standard salesforce.com setup if its true.It will not implement by default if it’s “FALSE”

ShowHeader

 It’s a Boolean type, displays or hides the salesforce header if true or false respectively.

Sidebar

 It’s a Boolean type, displays or hides the sidebar of standard salesforce site.

standardcontroller

 It’s the salesforce object that’s used to control the behaviour of this page, this attribute cannot be specified if custom controller is used.

<apex: page standardcontroller=”Tutorial__C”>

standardStylesheets

It’s a Boolean type; it decides whether the standard salesforce style sheets are added to the generated page header if the showheader attribute is set false, if it’s set true the standard style sheets are by default, added to the generated page header. The other important tags are tab style title, help URL & help title.

Visualforce page

<apex:page sidebar="false" showHeader="false" >
    <h1>Welcome to Tutorialkart.com</h1>
    	<p> In this Salesforce tutorial, we will learn about apex:page components and it's atrributes</p>
</apex:page>

Output

apex:page components

Conclusion

In this Salesforce tutorial, we have learned about <apex:page> component and its attributes. In our upcoming Visualforce tutorial, we will learn about different Visualforce components.