+ Start a Discussion
benderguybenderguy 

How to call a custom controller method with parameters from VisualForce?

I have a custom controller for a visualforce (VF) page, and I want to be able to run a method on that controller multiple times from the VF page with different parameters (method takes multiple parameters), displaying the results of each method call on the VF page (method output is a string).  Sounds simple, but I cannot figure out how to execute an apex method with parameters from VF.  If someone has a solution for this, or perhaps an alternative, please post an outline of how the VF and apex controller code should look.

 

Best Answer chosen by Admin (Salesforce Developers) 
SaaspertSaaspert

you can pass parameter from VF to Apex by using <apex:param tag

and retrieving value in Apex by using System.CurrentPageReference().getParameters().get('paramName'); 

Message Edited by Saaspert on 04-17-2009 04:19 PM
Message Edited by Saaspert on 04-17-2009 04:20 PM