Salesforce 在apexclass上单击Commandbutton无法获取其值

Salesforce 在apexclass上单击Commandbutton无法获取其值,salesforce,apex,Salesforce,Apex,VF代码: <apex:repeat value="{!strings}" var="stringer" id="theRepeat"> <apex:CommandButton value="{!stringer}" id="theValue"style="padding:10px;spacing:10px" action="{!repeatFunction}"> <apex:param name="paramValue" value="{!stringer}"

VF代码:

<apex:repeat value="{!strings}" var="stringer" id="theRepeat">

<apex:CommandButton value="{!stringer}" id="theValue"style="padding:10px;spacing:10px"  action="{!repeatFunction}">
<apex:param name="paramValue" value="{!stringer}"/>
</apex:commandButton>
</apex:repeat>
大家好,, 我想使用重复功能显示按钮的值。上面是我的代码,我无法分别显示按钮值


提前感谢。

在控制器中使用
名称属性值

 ButtonNum = apexpages.currentpage().getparameters().get('paramValue');

您可以使用apex:param的
assignTo
属性,它在控制器中给出值:

<apex:page controller="test">
  <apex:outputPanel id="msg">
      <apex:messages />
  </apex:outputPanel>
  <apex:form >
     <apex:repeat value="{!strings}" var="stringer">
        <apex:commandButton value="{!stringer}" id="theValue"  action="{!repeatFunction}" reRender="msg">
          <apex:param name="paramValue" value="{!stringer}" assignTo="{!ButtonNum}"/>
       </apex:commandButton>   
      </apex:repeat>
  </apex:form>
</apex:page>

希望它能帮助您

Happy Salesforce编码…..)
<apex:page controller="test">
  <apex:outputPanel id="msg">
      <apex:messages />
  </apex:outputPanel>
  <apex:form >
     <apex:repeat value="{!strings}" var="stringer">
        <apex:commandButton value="{!stringer}" id="theValue"  action="{!repeatFunction}" reRender="msg">
          <apex:param name="paramValue" value="{!stringer}" assignTo="{!ButtonNum}"/>
       </apex:commandButton>   
      </apex:repeat>
  </apex:form>
</apex:page>
public class test
{
  public String[]  getStrings() 
  {
      return new String[]{'ONE','TWO','THREE'};
  }
  public String ButtonNum {get;set;}
  public void repeatFunction()
  {  
     ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.Info,'num :'+ButtonNum ));    
 }
}