People, tell me where the thorn. There are two controllers (Spring), the first with @RequestMapping ("/") and the second with @RequestMapping ("/ admin"). The views are made using bootstrap. The essence of the question: when I refer to the page from the first controller, i.e. with requisition from only slash, page renders enter image description here as it should, if you refer to the page from the second controller, the page is displayed as text (see the picture).

I also rummaged and noticed that the matter is not even in different controllers (the method in the controller simply redirects to the jsp page), but this is: if the url on the page, for example, is href = "/ side_1", then everything is fine, but add a resource pointer, for example, href = "/ side_1 / side_2", then the bootstrap on the page redirected by the controller does not want to work and no matter what will be in the url after the second slash, parameters or just such a pointer

  • Mb problem in the bootstrap connection path? - jashka
  • 2
    Open the code for the first page (in the browser that came from the server), show what the <link> with the bootstrap looks like, then do the same for the second page. Most likely they will be something different. I believe that the matter is relative, for example. - Slava Semushin
  • the links are completely the same, the bootstrap connection is local (all as in the instructions), in the addConesourceHandler method in SpringConfig the paths to css and js are present. I solved the problem by the fact that in all controllers in @RequestMapping I changed the path to only "/" without additional branches like "/ admin" and it all worked. the division into controllers takes place using the annotation to the securit @PreAuthorize ("hasRole ('ADMIN')") in the controller itself. Nevertheless, the question remains open, since why such a conflict is not clear. - user_Kyrt

1 answer 1

When using jsp pages, the connection should look like this: link rel = "stylesheet" href = "/ bootstrap.min.css", if the page is html, then: link rel = "stylesheet" href = "bootstrap.min.css". those. the difference in the slash connection.