Error resolving template “index”, template might not exist or might not be accessible by any of the configured Template Resolvers

前端 未结 10 838
灰色年华
灰色年华 2020-12-01 07:28

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

相关标签:
10条回答
  • 2020-12-01 07:59

    this make me success!

    prefix: classpath:/templates/
    

    check your application.yml

    0 讨论(0)
  • 2020-12-01 08:02

    this can be resolved by copying the below code in application.properties

    spring.thymeleaf.enabled=false
    
    0 讨论(0)
  • 2020-12-01 08:05

    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.

    0 讨论(0)
  • 2020-12-01 08:08

    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
    
    0 讨论(0)
  • 2020-12-01 08:17

    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.

    0 讨论(0)
  • 2020-12-01 08:17

    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>
    
    0 讨论(0)
提交回复
热议问题