0
personal created an html page with a simple form and I’m wanting to use the links in jsp
1) java class "Calculus":
package principal; public class Calculo { public int n1; public int n2; public int resultado; }
2) html form
<form method="POST">
soma<input type="radio" name="soma"> | subtracao <input type="radio" name="sub"><br>
valor1:<input type="text" name="valor01"/><br>
valor2:<input type="text" name="valor02"/><br>
<input type="submit" value="calcular"/><br>
</form>
3) jsp (within html)
<%
Calculo c1 = new Calculo();
int valor1 = Integer.parseInt(request.getParameter("valor01"));
int valor2 = Integer.parseInt(request.getParameter("valor02"));
c1.n1 = valor1;
c1.n2 = valor2;
c1.resultado = valor1+valor2;
out.print(c1.resultado);
%>
I am using Tomcat 7, the error is as follows on line 21:
org.apache.jasper.JasperException: An exception occurred processing JSP page /teste.jsp at line 21
Line 21:
int valor1 = Integer.parseInt(request.getParameter("valor01"));
I’ve tried everything, and I still can’t, can anyone help me? vlw
it would be interesting to put all the error stacktrace
– Dudaskank