I wrote next jsp:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<h1>Monster Calculator</h1>
<FORM METHOD="POST" ACTION="Controller">
N1: <input type ="text" name="nr1" value="0">
op: <input type ="text" name="op" value="+">
N2: <input type ="text" name="nr2" value="0">
<INPUT class ="button" TYPE="submit" NAME="actiune" VALUE="Calculate"/>
</FORM>
<jsp:useBean id="binaryOperation" class="beans.BinaryOperation" scope="session"/>
<jsp:setProperty name="binaryOperation" property="*"/>
Message: <jsp:getProperty name="binaryOperation" property="nr1"/>
</body>
Theproblem is that I expect that next line:
Message: <jsp:getProperty name="binaryOperation" property="nr1"/>
to display "Message: 0" at runtime.
This is the bean:
public class BinaryOperation {
private String nr1 = "";
private String op = "";
private String nr2 = "";
public void setNr1(String nr1) {
this.nr1 = nr1;
}
public void setOp(String op) {
this.op = op;
}
public void setNr2(String nr2) {
this.nr2 = nr2;
}
public String getNr1() {
return nr1;
}
public String getOp() {
return op;
}
public String getNr2() {
return nr2;
}
}
Where is the problem?