Hello, i have to do a project that presents a form with 3
text fields like this
[img]http://i47.tinypic.com/1jsw44.jpg[/img]
type 2 numbers and then the symbol(+,/,*,-) and do the
appropriate action.
I am using Tomcat 6.0.
I've done so far:
#simple.html
<html>
<body>
<form method="post" action="simple.jsp">
Number_1<br> <input type="text" name="value1"><p>
Number_2<br> <input type="text" name="value2"><p>
Symbol<br> <input type="text" name="value3"><br>
<input type="submit" value="Submit">
</body>
</html>
#simple.jsp
<jsp:useBean id="SimpleBean" class="test.SimpleBean" scope="page">
</jsp:useBean>
<jsp:setProperty name="SimpleBean" property="*"/>
<% SimpleBean.add(); %>
<html>
<body>
Sum = <jsp:getProperty name="SimpleBean" property="result"/> <br>
Symbol = <jsp:getProperty name="SimpleBean" property="symbol"/>
</body>
</html>
#SimpleBean.java
package test;
public class SimpleBean {
private int value1;
private int value2;
private int result;
private String value3;
private String symbol;
public void setValue1(int x){
value1 = x;
}
public void setValue2(int x){
value2 = x;
}
public void setValue3(String x){
value3 = x;
}
public int getResult(){
return result;
}
public String getSymbol(){
return symbol;
}
public void add(){
result = value1+value2;
}
}
so far i didn't tried to check what the symbol is because i put
the program to print it and prints null.
Look: [img]http://i48.tinypic.com/otj5s1.jpg[/img]
i don't know what i'm doing wrong. :(
Please any help would be appreciated. :)