Ao acessar o buscaEmpresa, apresenta erro:
HTTP Status 500 - An exception occurred processing JSP page /WEB-INF/paginas/buscaEmpresa.jsp at line 12
type Exception report
message An exception occurred processing JSP page /WEB-INF/paginas/buscaEmpresa.jsp at line 12
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 /WEB-INF/paginas/buscaEmpresa.jsp at line 12
9: Lista de empresas :
10: <ul>
11: <c:forEach var="empresa" items="${empresas}" >
12: <li> ${empresa.getId()} : ${empresa.getEmail()} </li><br>
13: </c:forEach>
14: </ul>
15: </body>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:575)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
br.com.alura.gerenciador.web.BuscaEmpresa.doPost(BuscaEmpresa.java:28)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
br.com.alura.gerenciador.web.FiltroDeAuditoria.doFilter(FiltroDeAuditoria.java:42)
root cause
javax.el.MethodNotFoundException: Method not found: class br.com.alura.gerenciador.Empresa.getEmail()
javax.el.Util.findWrapper(Util.java:352)
javax.el.Util.findMethod(Util.java:214)
javax.el.BeanELResolver.invoke(BeanELResolver.java:174)
org.apache.jasper.el.JasperELResolver.invoke(JasperELResolver.java:139)
org.apache.el.parser.AstValue.getValue(AstValue.java:174)
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:950)
org.apache.jsp.WEB_002dINF.paginas.buscaEmpresa_jsp._jspx_meth_c_005fforEach_005f0(buscaEmpresa_jsp.java:145)
org.apache.jsp.WEB_002dINF.paginas.buscaEmpresa_jsp._jspService(buscaEmpresa_jsp.java:97)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
br.com.alura.gerenciador.web.BuscaEmpresa.doPost(BuscaEmpresa.java:28)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
br.com.alura.gerenciador.web.FiltroDeAuditoria.doFilter(FiltroDeAuditoria.java:42)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.70 logs.
Apache Tomcat/7.0.70
Código da classe
@WebServlet(urlPatterns="/buscaEmpresa")
public class BuscaEmpresa extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String filtro = ""; //req.getParameter("filtro");
Collection<Empresa> empresas= new EmpresaDAO().buscaPorSimilaridade(filtro);
req.setAttribute("empresas", empresas);
RequestDispatcher dispatcher = req.getRequestDispatcher("/WEB-INF/paginas/buscaEmpresa.jsp");
dispatcher.forward(req, resp);
}
Código JSP.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!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>Busca de empresas</title>
</head>
<body>
Lista de empresas :
<ul>
<c:forEach var="empresa" items="${empresas}" >
<li> ${empresa.getId()} : ${empresa.getEmail()} </li><br>
</c:forEach>
</ul>
</body>
</html>