I've been getting the same constant problem. Currently now I'm getting the error javax.el.PropertyNotFoundException: /index.xhtml @23,97 action="#{execise04.getInput}": Target Unreachable, identifier 'execise04' resolved to null
I'm not entirely sure what I'm doing wrong here is the code. I've looked at the other post that they say solved my issue and it doesn't solve my issue, and I don't understand a single thing its saying. Its not really giving a solution just turning me around in circles. Also I have had other issues such as once i press the button before I was getting a different error and it wouldn't open the second window that is supposed to display the output. Someone please help. I've been stuck on this for days and its getting incredibly frustrating.
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>Exercise04</title>
</h:head>
<h:body>
<h:form>
<center>
<h3>
Compute Loan Payment
</h3>
<h:panelGrid columns="2">
<h:outputLabel value="Loan Amount"/>
<h:inputText id="amount" value="#{exercise04.loanAmount}"/>
<h:outputLabel value="Annual Interest Rate"/>
<h:inputText id="rate" value="#{exercise04.annualInterestRate}"/>
<h:outputLabel value="Number Of Years"/>
<h:inputText id="years" value="#{exercise04.numberOfYears}"/>
</h:panelGrid>
<br />
<h:commandButton value="Compute Loan Payment" action = "#{execise04.getInput}"/>
</center>
</h:form>
</h:body>
</html>
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>Exercise02</title>
</h:head>
<h:body>
<center>
<h:outputText escape="false" value="{exercise02.table}" />
</center>
</h:body>
</html>
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean(name = "exercise04")
@SessionScoped
public class Exercise04 implements Serializable {
private double annualInterestRate;
private int numberOfYears;
private double loanAmount;
private java.util.Date loanDate;
public Exercise04() {
this(10, 1, 1000);
}
public Exercise04(double annualInterestRate, int numberOfYears, double loanAmount) {
this.annualInterestRate = annualInterestRate;
this.numberOfYears = numberOfYears;
this.loanAmount = loanAmount;
loanDate = new java.util.Date();
}
public double getAnnualInterestRate() {
return annualInterestRate;
}
public void setAnnualInterestRate(double annualInterestRate) {
this.annualInterestRate = annualInterestRate;
}
public int getNumberOfYears() {
return numberOfYears;
}
public void setNumberOfYears(int numberOfYears) {
this.numberOfYears = numberOfYears;
}
public double getLoanAmount() {
return loanAmount;
}
public void setLoanAmount(double loanAmount) {
this.loanAmount = loanAmount;
}
public double getMonthlyPayment() {
double monthlyInterestRate = annualInterestRate / 1200;
double monthlyPayment = loanAmount * monthlyInterestRate / (1
- (1 / Math.pow(1 + monthlyInterestRate, numberOfYears * 12)));
return monthlyPayment;
}
public double getTotalPayment() {
double totalPayment = getMonthlyPayment() * numberOfYears * 12;
return totalPayment;
}
public java.util.Date getLoanDate() {
return loanDate;
}
public String getInput() {
return "<p style=\"color:red\"><br />"
+ "Loan Amount: " + loanAmount + "<br />"
+ "Annual Interest Rate: " + annualInterestRate + "<br />"
+ "Number Of Years: " + numberOfYears + "<br />"
+ "Monthly Payment: " + getMonthlyPayment() + "<br />"
+ "Total Payment: " + getTotalPayment() + "</p>";
}
}