I have Written Apex Class:

public class one{
   public PageReference method() {
      return null;
   public string acName{set;get;}
   public integer acPhone{set;get;}
   public List<Account> accs{set;get;}
   public string accid {set;get;}
   public pagereference save(){
       //accid = apexpages.currentPage().getParameters().get('id');
       accs = [select id,name,phone,type from account limit 10];
       return null;

VisualForce Page:

<apex:page controller="one" action="{!save}">
    <apex:form >
        <apex:pageBlock id="one">
            <apex:pageBlockTable value="{!accs}" var="a">
                <apex:column value="{!a.id}"/>
                <apex:column value="{!a.name}"/>
                <apex:column >
                <apex:commandButton value="click" action="{!save}" reRender="two">
                <apex:param name="accountName" value="{!a.name}" assignTo="{!acName}"/>
        <apex:pageBlock id="two">
            <apex:pageBlockSection >
                <apex:pageBlockSectionItem >

what is the use of this Line:

<apex:param name="accountName" value="{!a.name}" assignTo="{!acName}"/>

if I Remove this Line also it is Not showing any Effect in the output,anyone explains the Logic for <apex:param> tag


In general term, the <apex:param> tag is used to pass values from JavaScript to an Apex controller, it can be used with the following parent tags.








<apex:commandButton value="click" action="{!save}" reRender="two">
    <apex:param name="accountName" value="{!a.name}" assignTo="{!acName}"/>

In general word, when you click on this button. apex:param will assign the a.name value to controller acName variable. This way you can get the Account name in controller

  • when i click the command button No action is Performed in the output, how to identify for the apex param value, shall i set any Debug log for this apex class
    – SFDC
    Aug 23 '16 at 6:15
  • what value should store in {!a name}, what Value should assigned,Please anyone explain Clearly
    – SFDC
    Aug 23 '16 at 6:18
  • @user36188 whatever value will have in account.name that value will assign to acName variable..
    – Ratan Paul
    Aug 23 '16 at 6:19
  • what is the use of <apex param>
    – SFDC
    Aug 23 '16 at 6:20
  • 1
    You are always Great @Ratan
    – SFDC
    Aug 23 '16 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.