I am working on a Loan calculator project ,in which user enters the age and annual income using jsp, the parameters are passed to a bean after going through some other
Classes,(same as in traderx example).
The bean method read the values and calculate the result and return a message using another class e.g LoanResult (same as TradeResult).
Problem is , logic is okay for calculation of loan in the method,I checked it using another class and by passing parameters,its returning the required result,but when its displaying the result in JSP,its returning null.(Also I checked the parameters values in the method by displaying them in JSP ,its displaying the right values as entered by user.)
The code for the method is:
public LoanResult calculateLoan(String age,int annincome) {
String message = null;
int loanapproved = 0;
if (age == “above”) {
if ( (annincome >= 10000) && (annincome <= 25000)){
loanapproved = 35000;
}
else if ( (annincome > 25000) && (annincome <= 35000) ) {
loanapproved = 45000;
}
else if (annincome > 35000){
loanapproved = 55000;
}
message = “Based on your annincome,you are eligible for ” + loanapproved;
} //closing if
else if (age == “below”) {
message = “You are not eligible for loan approval according ” +
“to our age limit policy”;
} ; // closing elseif
return new LoanResult(message);
}