【发布时间】:2016-07-14 08:36:03
【问题描述】:
到目前为止,我已经花了很多时间来完成这项工作,但仍然无法弄清楚。如何提供纯 .html 页面。这是项目: https://github.com/robson021/Invoice-Writer
Thymeleaf 引擎工作正常,但如果我尝试返回“常规”.html 文件,则会出错。
Whitelabel 错误页面 (...) 出现意外错误 (类型=内部服务器错误,状态=500)。异常解析文档: template="test",第 6 行 - 第 3 列
我承认这是因为我的“test.html”文件看起来不像 Thymeleaf 文件。但是,我尝试从 Maven 的 POM 中删除 Thymeleaf(或在 InteliJ 中创建新的项目形式 spring 初始化程序,没有 Thymeleaf 的项目,只有 Web)并将 .html 文件放入不同的目录(静态、公共、WEB-INF)但仍然失败.. . 我还尝试使用 Java 类手动配置项目。不幸的是得到了 404 或 500 错误。
由于这是学校项目,目标是让你的前端独立,我想使用纯 html 和 AngularJS。没有 .jsp 或模板引擎。
谁能告诉我如何让它工作是 Spring Boot 项目?
编辑:
我的控制器:
@Controller
public class TestController {
@RequestMapping("/test")
public String goToTestPage() {
return "test";
}
}
主类:
@SpringBootApplication
@EnableAutoConfiguration
public class InvoiceWriterApplication {
public static void main(String\[\] args) {
SpringApplication.run(InvoiceWriterApplication.class, args);
}
}
【问题讨论】:
标签: java html spring spring-mvc configuration