[SalesForce] apex param in apex repeat (pass parameter to controller in repeat) not working

I have an apex:repeat and I want to use and apex:param in it. The repeater shows the userName of the person who liked the feed (like.user.Name). And if this userName is same as the person who has logged in (activeUser.Name) then, I'm showing the outputText as You.

Basically, the rendered condition in outputText shown below is not working. The rendered condition calls a method and checks the param that I passed above is equal to the activeUser.Name and then returns true/false.

I checked the debug logs and found that "LikedUserName" param is getting null. how do I set the param value from the apex:repeat.

<apex:repeat value="{!feedItem.likes.likes}" var="like">
    [{!like.user.Name}] 
    <apex:param name="LikedUserName" value="{!like.user.Name}" assignTo="{!LikedUserName}" />
    <apex:outputText value="You!" rendered="{!LikedByYou}" />                                       
</apex:repeat>

>

public String LikedUserName{get;set{LikedUserName=value;}}

public boolean getLikedByYou(){
    if(activeUser.Name == ApexPages.currentPage().getParameters().get('LikedUserName')){
        return true; 
    }
    else return false;
}

Best Answer

Instead you can use the IF condition in the value attribute of the outputText

<apex:outputText value="{!IF(activeUser.Name == like.user.Name, 'You', like.user.Name)}" />
Related Topic