This question has been asked before but I did not solve my problem and I getting some weird functionality.
If I put my index.html file in the static directory like s
this make me success!
prefix: classpath:/templates/
check your application.yml
this can be resolved by copying the below code in application.properties
spring.thymeleaf.enabled=false
For me the issue was because of Case sensitivity. I was using ~{fragments/Base}
instead of ~{fragments/base}
(The name of the file was base.html
)
My development environment was windows but the server hosting the application was Linux so I was not seeing this issue during development since windows' paths are not case sensitive.
I am new to spring spent an hour trying to figure this out.
go to --- > application.properties
add these :
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
index.html
should be inside templates
, as I know. So, your second attempt looks correct.
But, as the error message says, index.html
looks like having some errors. E.g. the in the third line, the meta
tag should be actually head
tag, I think.
this error probably is occurred most of the time due to missing closing tag. and further you can the following dependency to resolve this issue while supporting legacy HTML formate.
as it your code charset="UTF-8"> here is no closing for meta tag.
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.22</version>
</dependency>