Bom dia a todos!!!
Estou tentando rodar meu código que é simples uma divisão por 2 em JSP mas esta dando erro e não consigo identificar o problema… Por favor ajudem!!!
Segue o ERRO
[code]
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 6 in the jsp file: /Resultado.jsp
Syntax error, insert “;” to complete Statement
3: Resultado Divisão por 2
4:
5:
6: <%request.getParameter(“num”)%>;
7:
8: float numero= (float) request.getAttribute(“num”);
9: float resultado=numero/2;
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 9 in the jsp file: /Resultado.jsp
Cannot cast from Object to float
6:
7: <%request.getParameter("num");
8:
9: float numero= (float) request.getAttribute("num");
10: float resultado=numero/2;
11:
12: out.print(resultado);
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.27 logs.
--------------------------------------------------------------------------------
Apache Tomcat/5.5.27