Não estou conseguindo chamar a listaContas na URL. Recebo a seguinte mensagem:
HTTP Status 404 - /contas/WEB-INF/views/listaContas.jsp
type Status report
message /contas/WEB-INF/views/listaContas.jsp
description The requested resource is not available. Pivotal tc Runtime 3.2.0.RELEASE/8.5.4.B.RELEASE
lista.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>Insert title here</title>
</head>
<body>
<table>
<tr>
<th>Código</th>
<th>Descrição</th>
<th>Valor</th>
<th>Tipo</th>
<th>Pago?</th>
<th>Data de 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="S{conta.paga ea false}">
Não paga.
</c:if>
<c:if test="S{conta.paga ea true}">
Paga!
</c:if>
</td>
<td><fmt:formatDate value="${conta.dataPagamento.time}" pattern="dd/MM/yyyy"/></td>
</tr>
</c:forEach>
</table>
</body>
</html>
contaController.java
package br.com.caelum.contas.controller;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.portlet.ModelAndView;
import br.com.caelum.contas.dao.ContaDAO;
import br.com.caelum.contas.modelo.Conta;
@Controller
public class ContaController {
@RequestMapping("/form")
public String formulario() {
return "formulario";
}
@RequestMapping("/adicionaConta")
public String adiciona(Conta conta) {
System.out.println("Conta adicionada é: " + conta.getDescricao());
ContaDAO dao = new ContaDAO();
dao.adiciona(conta);
return "conta-adicionada";
}
@RequestMapping("/listaContas")
public ModelAndView lista() {
ContaDAO dao = new ContaDAO();
List<Conta> contas = dao.lista();
ModelAndView mv = new ModelAndView("conta/lista");
mv.addObject("todasContas", contas);
return mv;
}
}