Sie sind auf Seite 1von 5

1: <apex:page>

1.apiVersion : This will specify the verion of api used in the VF page .

if you don’t specify any version no by default it will take latest version i.e 33.0

<apex:page apiVersion=”29.0” >

2.action : when ever we request the page from the server first it will perform the action

What we have defined in the page

Action can be a url of the page which need to be opened or a method from the class

3.showHeader : This is a Boolean value when we set it as true standard salesforce look and
feel of salesforce header and side bar components of the page displayed

When we set it as false salesforce header and sidebar components are not displayed

4.Sidebar : This is Boolean value when we set it as true sidebar components on the page

a re displayed.when we set it as false sidebar components are hidden

<apex:page sidebar=”false” >

5.setUp : This will take the Boolean value if set it as true setup admin menu will be
displayed

6.contentType : This wil specify content of the page and we can display the page in the
required format

contentType=”Vnd.ms-word#pagename.doc” for word document format

contentType=”Vnd.msexcel#pagename.xls” for xl format

7.renderAs : This is used to display the page pdf

renderAs=”pdf”

8.Id :This is used to refer to the component in the page

9.rendered

Q: How to display the data on the page

If we want to display the data on the VF page it should be displayed as formule expression

Syntax : {! Expression }

{! 10}

{! 10+20}
{! 'sam'}

{! 'Sam'&'kiran'}

{! ISNULL(10)}

{! ! ISNULL(10)}

Ex: <apex:page >


{! 10} <br/>
{! 10+20}<br/>
{! 'sam'}<br/>
{! 'Sam'&'kiran'}<br/>
{! ISNULL(10)}<br/>
{! ! ISNULL(10)}
</apex:page>

Q: How to refer to the global data using visualforce page

Global data : Data which remains same throughout the application once’s user has logged in is
called global data

Global data is prefixed with $

$User

$Profile

$UserRole

Synatax: { ! $GlobalObject.FieldName}

Ex: {!$User.LastName}

{!$User.Firstname}
<apex:page >
{!$User.FirstName}<br/>
{!$User.LastName}<br/>
{!$Organization.Name}<br/>
{!$Profile.Name}
</apex:page>

Q:How to pass the parameters using url

Synatx:https://ap2.salesforce.com/apex/pageName ?parameter=val

Ex: https://ap2.salesforce.com/apex/page1?Name=satish

If you want to pass more than one parameter in the url then parameters should be separated by
‘&’

Ex : https://ap2.salesforce.com/apex/page1?Name=satish & age=30

https://ap2.salesforce.com/apex/page1?name=satish&Age=30&qualificatiion=phd

Q: How to read the data from the URL of the page

If you want to read the data from the url then we have the following syntax

{! $Currentpage.parameters.paramtername}

Ex: {!$Currentpage.parameters.name}

<apex:page >
{!$Currentpage.parameters.name}<br/>
{!$Currentpage.parameters.age}
</apex:page>

Q: How to read the data from apex class into the VF page

If we want to refer the data from apex class into the VF page we have define the apex class as

Controller in apex:page component

Ex: <apex:page controller=”ApexclassName” >

public class Example1 {


public String name {set;get;}
public String branch{set;get;}
public Example1(){
name='Karthic';
branch='SRNagar';
}
}

VF page

<apex:page controller="Example1" >


Name :{!name}<br/>
Branch:{!branch}
</apex:page>
Ex: create a class Employee with employee name ,salary ,exp and initialize the values using
constructor and display the data in the VF page

public class Employee1 {


public String name {set;get;}
public Decimal Salary{set;get;}
public Decimal exp {set;get;}
public Employee1(){
name='Rajeev';
salary=90000;
exp=3.2;
}
}

<apex:page controller="Employee1">
Name :{! name} <br/>
salary:{!salary} <br/>
Exp :{! exp}
</apex:page>

Das könnte Ihnen auch gefallen