javascript - CSS and Java Script not rendering 404 error spring-boot -
here snippet of paths using:
<link rel="stylesheet" type="text/templates.css" href="../templates/css/superfish.css" th:href="@{../templates/css/superfish.css}"/> <link rel="stylesheet" type="text/templates.css" href="../templates/css/style.css" th:href="@{../templates/css/style.css}"/> <link rel="stylesheet" type="text/templates.css" href="../templates/css/nivo-slider.css" th:href="@{../templates/css/nivo-slider.css}"/> <link rel="stylesheet" type="text/templates.css" href="../templates/css/jquery.qtip.min.css" th:href="@{../templates/css/jquery.qtip.min.css}"/> <link rel="stylesheet" type="text/templates.css" href="../templates/css/jquery-ui.css" th:href="@{../templates/css/jquery-ui.css}"/> <link rel="stylesheet" type="text/templates.css" href="../templates/css/jquery.fancybox.css" th:href="@{../templates/css/jquery.fancybox.css}"/> <link rel="stylesheet" type="text/templates.css" href="../templates/css/jquery.fancybox-buttons.css" th:href="@{../templates/css/jquery.fancybox-buttons.css}"/>
controller:
@requestmapping(value="/", method= requestmethod.get) public string contactform(@valid @modelattribute("contact") contact contact, bindingresult bindingresult, httpservletrequest request, model model, device device) throws ioexception { system.out.println("inside controller-----------------");
main method:
@springbootapplication @componentscan("com.stidham") public class stidhamfinancialapplication extends springbootservletinitializer { @override protected springapplicationbuilder configure(springapplicationbuilder application) { return application.sources(stidhamfinancialapplication.class); } public static void main(string[] args) { springapplication.run(stidhamfinancialapplication.class, args ); } }
only html renders, no js or css. have tried several ways , path have looks correct , ide auto fills type in path.
in war file in correct place.
mvn clean install
builds correctly, they're no dependency issues. seems simple path issue not working when deployed.
---------------update 1---------------
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="format-detection" content="telephone=no"/> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> <link rel="stylesheet" type="text/css" href="/css/superfish.css" /> <link rel="stylesheet" type="text/css" href="/css/style.css" /> <link rel="stylesheet" type="text/css" href="/css/nivo-slider.css" /> <link rel="stylesheet" type="text/css" href="/css/jquery.qtip.min.css" /> <link rel="stylesheet" type="text/css" href="/css/jquery-ui.css" /> <link rel="stylesheet" type="text/css" href="/css/jquery.fancybox.css" /> <link rel="stylesheet" type="text/css" href="/css/jquery.fancybox-buttons.css"/>
still getting 404 js , css:
the folder "templates" reserved thymeleaf process html. javascript , css should in folder "static". folder mapped directly root url http.
example: file located in ... /resources/static/css/superfish.css
<link rel="stylesheet" href="/css/superfish.css" />
Comments
Post a Comment