Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
@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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!