[SalesForce] apex:param not passing parameter to controller

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

<apex:Outputpanel>
<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:commandLink>
        <apex:variable value="{!row+1}" var="row"/>
    </apex:repeat>
</apex:Outputpanel>

Controller:

public Integer pos {get; set;}


public PageReference performAction() {

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

    return null;
}

So what is wrong here?

Best Answer

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

Update:

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"/>
Related Topic