0
votes

I am using Spring boot starter project with maving pluging, spring boot can't know the links in my HTML templates. this is my controller :

@Controller
@EnableAutoConfiguration
@ComponentScan
public class Demoproject2Application {
@RequestMapping("/")
public String home() {
    return "/html/Authentification";
}
}

and this is the Authentification.HTML:

<!DOCTYPE html>
<html>
<head>
<title>Authentification</title>

<link rel="stylesheet" type="text/css" href="css/style2.css" />

and this is the error :

2015-02-19 14:29:58.749  INFO 5136 --- [nio-8090-exec-1] o.a.c.c.C.[Tomcat].    [localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'

2015-02-19 14:29:58.749 INFO 5136 --- [nio-8090-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started 2015-02-19 14:29:58.774 INFO 5136 --- [nio-8090-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 25 ms 2015-02-19 14:29:59.086 WARN 5136 --- [nio-8090-exec-2] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/css/style2.css] in DispatcherServlet with name 'dispatcherServlet' 2015-02-19 14:30:00.813 WARN 5136 --- [nio-8090-exec-4]o.s.web.servlet.PageNotFound

here is a snapshot of the hierarchy of my project :

https://fbcdn-sphotos-f-a.akamaihd.net/hphotos-ak-xfp1/v/t1.0-9/11011221_811266045595770_3095529215585152558_n.jpg?oh=a51a1196651bd62c81a76679869c1bdd&oe=558FD62B&gda=1431221666_e2d5202a80db81801ed9903c48014130

1
The INFO message is just indicating that /css/style2.css is not found and will result in a 404. Without knowing how you organized your files in the project it is hard to tell where your issue actually is.daniel.eichten
here is a snapshot of the hierarchy of my project : fbcdn-sphotos-f-a.akamaihd.net/hphotos-ak-xfp1/v/t1.0-9/…Meryem Elouragini
I tried to put the file style2.css and Authentification.html in the same directory but still the same error " o.s.web.servlet.PageNotFound" I didn't get what is missing.Meryem Elouragini

1 Answers

1
votes

If you didn't changed any defaults it should be served when you put it into src/main/resources/static/css/style2.css. Please see official documentation.