How are request parameters sent via component

when we use apex:param inside an apex:actionFunction component as given below

<apex:page controller="testCon">
<apex:outputText value="Clicked? {!state}" id="showstate" />
<apex:outputPanel onclick="methodOneInJavascript('Yes!')" styleClass="btn">
    Click Me
    <apex:actionFunction action="{!methodOne}" name="methodOneInJavascript" rerender="showstate">
        <apex:param name="firstParam" assignTo="{!state}" value="" />

public class testCon {

    public void setState(String n) {
        state = n;

    public String getState() {
        return state;

    public PageReference methodOne() {
        return null;

    private String state = 'no';

How will be the request parameter firstParam sent to the controller when an Ajax request happens? Is it via query string parameter or in the body of the request (as in POST request) ?


When you declare an actionFunction a javascript function name equal to actionFunction’s attribute name named is declared and initialised on rendered visualforce page.


<apex:actionFunction action="{!methodOne}" name="methodOneInJavascript" rerender="showstate">
        <apex:param name="firstParam" assignTo="{!state}" value="" />

Above code will rendered as:

var methodOne = function(firstParam, otherConfigParams) {

// Ajax implemetation


and when you call this actionfunction by apex:commandButton or by any other method it sends post request to visualforce page url and the request url seems like:


and the Ajax request constructed ( Body ) as:

com.salesforce.visualforce.ViewState: "i:COMPLETE VIEWSTATE"
com.salesforce.visualforce.ViewStateCSRF: "SecurityChecks"
com.salesforce.visualforce.ViewStateMAC: "AJUrHNkMoCfHaWCeqkFxDJVJ2D+b"
com.salesforce.visualforce.ViewStateVersion: "201310242028360004"
j_id0:j_id9: "j_id0:j_id9" // FORM_ID
j_id0:j_id9:j_id10: "j_id0:j_id9:j_id10"
firstParam: "VALUE_SENDING"

So each request send by actionFunction is POST request and content sent is exist in body.

We cannot say that request is sent like https://www.salesforcedomain/apex/vfpagemae?Params=abcdf and page can only get params through it.

Basically Salesforce has its own way and it assign all values to MAP ApexPages.CurrentPage().getParametrs() either it recieved from Query URL String or from body.

Source : Link , Question Author : codebandit , Answer Author : Ashwani

Leave a Comment