You need to sign in to do that
Don't have an account?
Darshit Pathak 3
How to call extension method in VF page when used with custom controller?
If my VF page already has custom controller. Now I am creating extension class with method getVal() , how can I call this extension method in my VF page?
Directly I cannot call any extension method.. right? need to modify existing custom controller at least to call the extension method. Am I correct?
<apex: page controller="cont1" extensions="ext1">
<apex:outputText value="{!valCont}"/>
</apex:page>
public class cont1{
public static String getValCont() {
return ext1.getValext();
}
}
public class ext1{
public static String getValext(){
return 'this is my extension class';
}
}
<apex: page controller="cont1" extensions="ext1">
<apex:outputText value="{!valCont}"/>
</apex:page>
Helper Class
public class cont1{
public static String getValCont() {
return 'this is my extension class';
}
}
Extension
public class ext1{
public String getValext(){
return cont1.getValext();
}
}