You need to sign in to do that
Don't have an account?
Revati Bhavsar
How to display the value from different apex class on a visualforce page with different controller?
I have created an apex class for EMI_calculation to estimate EMI for a particular loan applicant and it is stored in variable EMI. I want to display this
EMI value on visualforce page "Applicant" with different controller class after saving th applicant page.
Following is the EMI_Calculation class:
EMI value on visualforce page "Applicant" with different controller class after saving th applicant page.
Following is the EMI_Calculation class:
public with sharing class EMI_Calculation { public CustBusinessPro__Applicant__c applicant{get;set;} public Decimal RateOfInterest{get;set;} public Decimal EMI{get;set;} public void EMICalculation(Decimal Principal, Decimal Period) { applicant = new CustBusinessPro__Applicant__c(); RateOfInterest = 12.5/1200; System.debug('----------' + Principal); System.debug('----------' + Period); Period=Period*12.0; Integer myInt = Integer.valueOf(Period); Decimal nr = (1+RateOfInterest); Decimal powDec = nr.pow(myInt); EMI= (Principal*RateOfInterest*powDec)/(powDec-1); System.debug('-------------' + EMI + 'Rs'); } }
You can create an object to the above class and use it in your Visualforce page.
You can create a member variable of EMI_Calculation in your other controller and you can able to access all its member variable and methods.
Please do let me know if it helps you.
Regards,
Mahesh
Please provide your VF and class files so that we will help you better.
Regards,
Mahesh
You didn't copy the full VF page and also what error you are getting.
Regards,
Mahesh
public String getEMI() {
EMI_Calculation e = new EMI_Calculation();
return String.ValueOf(e.EMI);
}