JSP - CSS file and JS files aren't loading at all
posted 4 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I'm unable to load js and css files in JSP file. In desktop it runs as `http://localhost/` but in server it will run as `http://localhost/myapp/`. How can I ensure it works everywhere?
GET http://localhost:8080/js/jquery.min.js net::ERR_ABORTED 404 (Not Found)
GET http://localhost:8080/css/bootstrap.min.css net::ERR_ABORTED 404 (Not Found)
In head Head tag I have this..
<script src="/js/jquery.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">
Edit: I tried the following and it's still not working..
Edit: even tried the following as suggested in this https://www.codejava.net/frameworks/spring-boot/how-to-create-a-spring-boot-web-application-spring-mvc-with-jsp-thymeleaf
GET http://localhost:8080/js/jquery.min.js net::ERR_ABORTED 404 (Not Found)
GET http://localhost:8080/css/bootstrap.min.css net::ERR_ABORTED 404 (Not Found)
In head Head tag I have this..
<script src="/js/jquery.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">
Edit: I tried the following and it's still not working..
Edit: even tried the following as suggested in this https://www.codejava.net/frameworks/spring-boot/how-to-create-a-spring-boot-web-application-spring-mvc-with-jsp-thymeleaf
posted 4 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Nothing that is inside WEB-INF will be served directly to the client. You need to move JS and CSS (and everything else directly accessed by the browser, like images) to a directory outside WEB-INF.
The configuration in application.properties is only for JSP pages.
The configuration in application.properties is only for JSP pages.
posted 4 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Additionally you'll need to precede all paths with the context path of the application. It can be obtained in a JSP with the EL expression: ${pageContext.request.contextPath}
posted 11 months ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hello Bear,
I am facing the problem using Tomcat server 10.1.34, I have included the
but when i rendered the jsp page on the browser, it is still giving me 404.
What can I do ?
Unfortunately, the copy that is working is saved in a hard disk that is 'spoilt' ....
I am facing the problem using Tomcat server 10.1.34, I have included the
but when i rendered the jsp page on the browser, it is still giving me 404.
What can I do ?
Unfortunately, the copy that is working is saved in a hard disk that is 'spoilt' ....
| Can't .... do .... plaid .... So I did this tiny ad instead: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |













