In my code the parameter in an apex:param does not get passed on to the controller. Here is the code for Visualforce:

<apex:variable value="{!1}" var="row"/>
    <apex:repeat value="{!list}" var="item">
        <apex:commandLink value="Action" action="{!performAction}">
             <apex:param value="{!row-1}" assignTo="{!pos}"/>
        <apex:variable value="{!row+1}" var="row"/>


public Integer pos {get; set;}

public PageReference performAction() {

    if (list[pos] != null){
        delete list[pos];   

    return null;

So what is wrong here?

  • It looks like you may be attempting to modify the displayed contents, of some collection, on your visualforce page. Am I right? If so, I can expand on this comment in an answer. Also, if I'm right, this is an example of an X-Y problem (where you ask about how to fix your chosen solution instead of asking for help in achieving your overall goal), and I'd suggest using an <apex:actionSupport> along with rerender to accomplish a partial page refresh instead of specifying the action attribute in your <apex:commandLink>.
    – Derek F
    May 2, 2017 at 20:36

1 Answer 1


Though optional you have to put in a name attribute for the apex:param.


A similar question was answered on why param needs a name attribute. Param gets passed as a key value pair to the controller, you have to specify name for the key value pair to be generated.

<apex:param> assignTo attribute not setting value to contoller variable

         <apex:param value="{!row-1}" assignTo="{!pos}" name="pos"/>
  • @DanielBallinger the op is using commandlink which as per the idea should work without re-render attribute? I put in a name attribute and tested, the value gets passed to teh controller
    – Rao
    May 2, 2017 at 20:43
  • Ah right. Missed that bit. May 2, 2017 at 20:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .