You need to sign in to do that
Don't have an account?
Agendum
Execute controller method in apex page?
I know this is a very simple question, but my search in the IDE help revealed nothing. If I have a method in a controller, how do I execute it in the view? For example:
// ----------------------
// In the controller
public static String test(String arg)
{
return arg;
}
// ----------------------
// In the view
<div>{!test('foo')}</div>
Thanks!
~ devin
You cannot call a method which has arguments from a page.
Better you define a constructor and call your method from the constructor.
/*Under your constructor*/
test('foo');
Regards,
Shravan
All Answers
It will depend on the event. You want to execute it on Page Load or at any specific event?
put the action attribute in the page component in ordre to run that method
<apex:page action="{!test}"/>
You cannot call a method which has arguments from a page.
Better you define a constructor and call your method from the constructor.
/*Under your constructor*/
test('foo');
Regards,
Shravan
sorry i missed out that.. my intension is to give him a thought in how to call a method from page.. when it loads...