facebook

Bean method not returning the required result

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #247211 Reply

    Ghazalawahid
    Member

    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);

    }

    #247231 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Bean method not returning the required result

You must be logged in to post in the forum log in