+ Start a Discussion

adding parameters to get methods allowed?

Hi - I have a get method that I would like to take a parameter.


For example - let's just say I have a method in a controller extension called getMyOpportunity which takes as an argument, an id.


Now I want to use this in a VF page like so:



However, I don't know how to pass the parameter to the function.  Is this even possible? 



You can't add parameters to a get method. But depending on how you invoke the get method, you can use Apex Param Component to pass the value.


Here is the example from the Visualforce Developer's Guide;


<apex:page standardController="Contact"> <apex:outputLink value="http://google.com/search">Search Google <apex:param name="q" value="{!contact.name}"/> </apex:outputLink> </apex:page>