Cuando quiero transladarme a otra página me sale error, intente varios métodos para cuando me aprete el link me dirija a la pagina siguiente pero no me dirige y me sale error 404
[enter image description here][2]http://i.stack.imgur.com/yFq9L.png
En el controlador he puesto el html central
package pe.edu.ucs.jpa2022.controller;
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;@ComponentScan(basePackages=("pe.edu.ucs.jpa2022.controller"))
@Controller
public class HomeController {
@GetMapping("/")
public String index(){
return "indexnuevo";
}
}
Aqui quiero dirigir “nuevo.html” pero dice que no lo mapea
<!DOCTYPE html>
<html lang="es" xmlns:th="http://www.thymeleaf.org">
<head>
<title>spring</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link th:rel="stylesheet" th:href="@{/webjars/bootstrap/4.6.1/css/bootstrap.min.css} "/>
<link th:rel="stylesheet" th:href="@{/webjars/font-awesome/6.1.0/css/all.css} "/>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<style>
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="nuevo.html">Control de tienda</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="nuevo.html" th:src="@{/js/script.js/nuevo.html}">Agregar Producto</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container text-center">
<br>
<h3>Lista de Clientes</h3>
<hr>
<button class="btn btn-danger mb-5" data-toggle="modal" data-target="#modalGuardar" data-whatever="@mdo">Add</button>
<div class="row">
<div class="col">
<table class="table table-bordered" id="tablita">
<thead class="thead-dark">
<tr>
<th scope="col">#</th>
<th scope="col">ID</th>
<th scope="col">NOMBRES</th>
<th scope="col">TELEFONO</th>
<th scope="col">DIRECCION</th>
<th scope="col" colspan="2">ACCIÓN</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<!-- Modal Guardar Post -->
<div class="modal fade" id="modalGuardar" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Nuevo Empleado</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="recipient-name" class="col-form-label">Nombre:</label>
<input type="text" class="form-control" id="nombre" placeholder="Nombre">
</div>
<div class="form-group">
<label for="message-text" class="col-form-label">Apellido:</label>
<textarea class="form-control" id="apellido" placeholder="Apellido"></textarea>
</div>
<div class="form-group">
<label for="message-text" class="col-form-label">DNI:</label>
<textarea class="form-control" id="dni" placeholder="DNI"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="guardar">Registrar Empleado</button>
</div>
</div>
</div>
</div>
<!-- Modal Modificar Post -->
<div class="modal fade" id="modalEditar" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modificar Empleado</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="recipient-name" class="col-form-label">Nombre:</label>
<input type="text" class="form-control" id="editar_nombre" placeholder="Nombre">
<input type="hidden" class="form-control" id="idempleado" value="0">
</div>
<div class="form-group">
<label for="message-text" class="col-form-label">Apellido:</label>
<textarea class="form-control" id="editar_apellido" placeholder="Apellido"></textarea>
</div>
<div class="form-group">
<label for="message-text" class="col-form-label">DNI:</label>
<textarea class="form-control" id="editar_dni" placeholder="DNI"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="modificar">Modificar Empleado</button>
</div>
</div>
</div>
</div>
<script th:src="@{/webjars/jquery/jquery.min.js}"></script>
<script th:src="@{/webjars/popper.js/umd/popper.min.js}"></script>
<script th:src="@{/webjars/bootstrap/js/bootstrap.min.js}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/5.5.2/bootbox.min.js"></script>
<script th:src="@{/js/script.js}"></script>
</body>
</html>
Así está elaborado, lo estoy implementando con BD