Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

208
Vistas
@GetMapping("/home") and @GetMapping("/folders/{id}") redirecting the same jsp/js file

I would like that @GetMapping("/home") and @GetMapping("/folders/{id}") redirect to the same home.jsp page/view, where I use jquery and ajax to createcontent. Unfrotunately when I call @GetMapping("/folders/{id}") in my Controller .js file is not working in my .jsp (the view doesn't recognize .js file and doesn't use jquery to build html page), but for @GetMapping("/home") everything works. Anyone knows why?

HomeController.java

@Controller public class HomeController {

private final FolderService folderService;

@Autowired
public HomeController(FolderService folderService) {
    this.folderService = folderService;
}

**@GetMapping("/home")
public String home(
) {
    return "home";
}

@GetMapping("/folders/{id}")
public String foldersId(
) {
    return "home";**
}

}

home.jsp

<html>
<head>
    <meta charset="UTF-8">

    <title>BOOKMARKS APP</title>

    <!--Bootstrap-->
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
    <!--CSS-->
    <link rel="stylesheet" href="css/style.css">
    <!--jQuery-->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js"></script>
    <!--JS files-->
    **<script src="js/index.js" type="text/javascript"></script>
    <script src="js/home.js" type="text/javascript"></script>**
</head>
<body>
</body>

Errors in console:

enter image description here

File structure:

enter image description here

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda