A parameter for the parent component. The <apex:param> component can only be a child of the following components: <apex:actionFunction> <apex:actionSupport> <apex:commandLink> <apex:outputLink> <apex:outputText> <flow:interview>
<!-- For this example to render fully, associate the page
with a valid contact record in the URL.
For example: https://Salesforce_instance/apex/myPage?id=001D000000IRt53 -->
<apex:page standardController="Contact">
<apex:outputLink value="http://google.com/search">
Search Google
<apex:param name="q" value="{!contact.name}"/>
</apex:outputLink>
</apex:page>
Basically the apex:param tag is used to pass values from the Visualforce Page to the Apex Controller. A simple use case could be this:
Use Case: Display all the Leads in the Database in a tabulated form. There should be 2 Columns in which the first column would display the Lead Name and the last column will have a Delete button. When the User clicks the Delete button, the corresponding Lead will be Deleted from the Database. Apex class
public class ApexParamDemoController{
//Property to hold the Id of the Record to be Deleted
public Id RecordToDelete {get; set;}
//Query all the Leads from the Database
public List<Lead> AllLeads{
get{ return [SELECT Id, Name FROM Lead]; }
}
//Delete the Record from the Database
public void deleteRecord(){
DELETE new Lead(Id = RecordToDelete);
}
}
It has an apex:commandButton that invokes the apex method - deleteRecord via the action attribute. Now, you should also notice that this very command button wraps an apex:param tag too.
This apex:param tag is responsible for passing the ID of the that Lead record. The apex:param passes the value contained in {!Lead.Id} and assigns it to the property back in the Apex Class - RecordToDelete. So when the Delete button is clicked first the value will be assigned to the RecordToDelete via the apex:param tag and then the method - deleteRecord will be executed.
1) https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_param.htm
A parameter for the parent component. The <apex:param> component can only be a child of the following components:
<apex:actionFunction>
<apex:actionSupport>
<apex:commandLink>
<apex:outputLink>
<apex:outputText>
<flow:interview>
2) https://success.salesforce.com/answers?id=90630000000hfRmAAI
Basically the apex:param tag is used to pass values from the Visualforce Page to the Apex Controller. A simple use case could be this:
Use Case:
Display all the Leads in the Database in a tabulated form. There should be 2 Columns in which the first column would display the Lead Name and the last column will have a Delete button. When the User clicks the Delete button, the corresponding Lead will be Deleted from the Database.
Apex class
Your Visualforce Markup:
It has an apex:commandButton that invokes the apex method - deleteRecord via the action attribute. Now, you should also notice that this very command button wraps an apex:param tag too.
This apex:param tag is responsible for passing the ID of the that Lead record. The apex:param passes the value contained in {!Lead.Id} and assigns it to the property back in the Apex Class - RecordToDelete. So when the Delete button is clicked first the value will be assigned to the RecordToDelete via the apex:param tag and then the method - deleteRecord will be executed.
Let us know if this will help u