将参数从 VF 页面传递到命令按钮操作

Pass the parameter from the VF page to command button action

我有 VF 页面,通过自定义按钮我将参数传递给 VF URL 作为 https://abc--c.cs41.visual.force.com/apex/Send_Env_Email?OppId=00655D0Z8 我想在同一页面中检索它,以便我可以将它传递到命令按钮调用另一个控制器方法

<apex:page  controller="test_Controller1">
  <apex:form >
      <apex:pageBlock >
         <h1>Send a Signing Request via Email</h1>
         <p>This form will send a DocuSign signing request. 
         Are you sure you want to send it?</p> 
         <p><apex:commandButton action="{!send}" onclick="clicked();" rerender="dssdk_output" value="Send!" /></p>
      </apex:pageBlock>  
  </apex:form>

因为test_Controller1里面的send()在找入参Public void send(set<id> oppIds)

如果我没有正确理解您要完成的任务;您不需要将它从页面传递到控制器。您可以在控制器中访问 url 个参数。

public pageReference send()
{
   String oppID = ApexPages.CurrentPage().getParameters().get('OppId');
   --Rest of your code here --
}

然后您可以使用 oppID 附加到您将用户重定向到的页面。

在纯 Visualforce 中,该参数应该在 {!$CurrentPage.parameters.OppId}

中可用

但是对于你的用例来说,最好按照 Psymn 的建议去做,只需在构造函数中获取值,保存到一些辅助字符串变量中,它应该在整个 class.[=12= 中可见]