Código
<body> <div class="col-12"> <button type="button" class="btn btn-success" data-toggle="modal" data-target="#agregarNoticiaModal">Agregar</button> <div class="modal fade" id="agregarNoticiaModal" tabindex="-1" role="dialog" aria-labelledby="addClassModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="agregarNoticiaModalLabel">Agregar Noticia</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> </button> </div> <div class="modal-body"> <form action="#" method="POST" th:action="@{/save}" th:object="${noticia}"> <div class="form-group"> class="form-control" id="titulo" value="" th:name="titulo" /> </div> <div class="form-group"> class="form-control" id="descripcion" value="" th:name="descripcion" /> </div> <div class="form-group"> <fieldset style="margin-left: 10px;"> <input id="fileUpload" type="file" style="margin-left: 20px" value="" th:name="imagen" /> </fieldset> </div> <input type="submit" value="Aceptar" /> </form> </div> </div> </div> </div> <table class="table table-bordered table-responsive p-3"> <thead class="thead-dark"> <tr class="text-center"> </tr> </thead> <tbody> <tr class="text-center" th:each="noticia : ${list}"> th:src="${noticia.imagen}"></td> <td> <form method="post"> <input type="hidden" name="id" /> <button type="submit" class="btn btn-danger"> </button> </form> </td> </tr> </tbody> </table> <div class="row"> <div class="col-md-8"> <nav aria-label="Pagination"> <ul class="pagination justify-content-center"> <li class="page-item" th:classappend="${prev == 0 ? 'disabled': ''}"><a <li class="page-item" th:each="page : ${pages}" th:classappend="${current == page ? 'active': ''}"><a class="page-link" th:href="@{|/noticias/?page=${page}|}" <li class="page-item" th:classappend="${current == last ? 'disabled': ''}"><a </ul> </nav> </div> </div> </div> </body>
Y los métodos de mi controlador para guardar son estos:
Código
@RequestMapping(value = "/save", method = RequestMethod.POST) this.noticia.save(noticia); return "redirect:/"; }
Que puede ser? Tambien sucede que cuando hago un alta me redirecciona al /index , cuando debería ser a /noticias