Pessoal, quando tento executar minha ação para listar contas aparece o seguinte erro:
org.apache.jasper.JasperException: javax.el.PropertyNotFoundException: Property 'id' not found on type java.lang.String
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:555)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1217)
org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Segue o código do meu controler
@RequestMapping("/listaContas")
public ModelAndView listaContas(){
ContaDAO dao = new ContaDAO();
List<Conta> contas = dao.lista();
ModelAndView mv = new ModelAndView("conta/lista");
mv.addObject("todasContas", contas);
return mv;
}
E o código do jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!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=UTF-8">
<title>Lista de Contas</title>
</head>
<body>
<h3>Contas Cadastradas</h3>
<table>
<tr>
<th>Código</th>
<th>Descrição</th>
<th>Valor</th>
<th>Tipo</th>
<th>Status</th>
<th>Data Pagamento</th>
</tr>
<c:forEach items="todasContas" var="conta">
<tr>
<td>${conta.id}</td>
<td>${conta.descricao}</td>
<td>${conta.valor}</td>
<td>${conta.tipo}</td>
<td><c:if test="${conta.paga eq false}">
Não Paga
</c:if>
<c:if test="${conta.paga eq true}">
Paga
</c:if></td>
<td><fmt:formatDate value="${conta.dataPaagamento.time}" pattern="dd/MM/yyyy"/></td>
</tr>
</c:forEach>
</table>
</body>
</html>