Olá!
Sou novo no desenvolvimento em jsp, e estou com algumas dúvidas.
Tenho um form que tenho que informar o nome, nota1 e nota2 de uma pessoa, e apresentar a soma deles em um outro campo.
Porém, ao executar, aparece a seguinte mensagem de erro no Eclipse:
============================================================
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /resultado.jsp at line 29
26: </style>
27: </head>
28: <%
29: int m1 = Integer.parseInt(request.getParameter(“nota1a1”)) + Integer.parseInt(request.getParameter(“nota2a1”));
30: %>
31: <body>
O código que estou utilizando é o seguinte:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Notas</title>
<style>
body, td, a:link, a:visited
{
font-family: Verdana;
font-size: 10px;
color: #000000;
text-decoration: none;
}
a:hover
{
color: #FF0000;
}
input
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
background-color: #FFFFFF;
border: 1px solid #AAAAAA;
}
</style>
</head>
<%
int m1 = Integer.parseInt(request.getParameter("nota1a1")) + Integer.parseInt(request.getParameter("nota2a1"));
%>
<body>
<p>Notas</p>
<form method="post">
<table style="WIDTH: 391px; HEIGHT: 154px" width="391" border="0">
<tbody>
<tr>
<td>Alunos</td>
<td>Nota 1</td>
<td>Nota 2</td>
<td>Média Final</td>
</tr>
<tr>
<td><input name="aluno1" type="text" value="Rodrigo"></td>
<td><input name="nota1a1" type="text" value="1"></td>
<td><input name="nota2a1" type="text" value="2"></td>
<td><%= m1 %></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
Porém, se seu fixar um valor em m1, a página roda e o valor é exibido normalmente.
Alguma dica de onde posso estar errando?