我已经创建了一个Spring引导启动thymeleaf项目版本2.2.6-RELEASE与IntelliJ版本2020.1.不幸的是,我不知道为什么thymeleaf模板中的链接没有提到下一个。
当我启动项目并在我的web浏览器中键入“localhost:8080”时,索引将被删除。html站点是可见的。单击索引内的“a href”后。html,web浏览器向我显示url,例如“localhost:8080/product.html”,并显示404错误。
项目结构如下:项目结构
index.html文件:
<!DOCTYPE html>
<html xmlns:th ="http://www.thymeleaf.org" lang="de">
<head>
<meta charset="UTF-8">
<title>Naturkost Warenmanagement</title>
<link th:href="@{/stylesheet.css}" rel="stylesheet" />
</head>
<body>
<div id="container">
<div id="header">
<h1>Warenmanagement</h1>
<h2>Geschenke und Naturkost</h2>
</div>
<div id="content">
<div id="nav">
<h3>Navigation</h3>
<ul>
<li><a th:href="@{/index.html}">Home</a></li>
<li><a th:href="@{/product.html}">Artikel</a></li>
<li><a th:href="@{/employee.html}">Mitarbeiter</a></li>
<li><a th:href="@{/order.html}">Bestellung</a></li>
<li><a th:href="@{/stockground.html}">Lager</a></li>
<li><a th:href="@{/supplier.html}">Lieferant</a></li>
<li><a th:href="@{/transaction.html}">Lager Transaktion</a></li>
</ul>
</div>
.
.
.
.
@Controller NavigationController.class:
@RequestMapping("/index")
public String index() {
return "index";
}
@RequestMapping("/employee")
public String employee(){
return "employee";
}
@RequestMapping("/order")
public String order(){
return "order";
}
@RequestMapping("/product")
public String product(){
return "product";
}
@RequestMapping("/stockground")
public String stockground(){
return "stockground";
}
@RequestMapping("/supplier")
public String supplier(){
return "supplier";
}
@RequestMapping("/transaction")
public String transaction(){
return "transaction";
}
我做错了什么?
删除。html
来自操作:
html prettyprint-override"><li><a th:href="@{/index.html}">Home</a></li>
保持它像:
<li><a th:href="@{/index}">Home</a></li>
现在它将运行并点击API-localhost:8080/
相应的
. html
将通过使用视图解析器的Spring引导添加。
我有两个php应用程序:一个托管在example.com上,一个托管在example.org上。这两个应用程序都是不可或缺的,这意味着当用户使用example.com的应用程序时,它也会使用example.org,因为应用程序的一部分位于example.com,另一部分位于example.org。但有个问题。当用户使用example.com并需要example.org的功能时,他会通过单击exam
我使用springboot和maryadb数据库进行训练。当我测试数据恢复时,我在邮递员中收到这样一条消息: 。我在复制粘贴中尝试了几个教程,我总是有相同的消息。我也会把控制台中的消息。提前谢谢你的帮助。 控制器 服务 回应的 模型 应用属性 安慰
我在rest api应用程序中使用Springboot 1.5.7,并使用thymeleaf模板从我的api发送电子邮件。但是当我将spring boot的版本更新到2.0.2时,它抛出了404错误,即“错误解析模板”错误,模板可能不存在,或者任何配置的模板解析程序都无法访问“。 下面是application.yml中的配置 pom.xml中的thymeleaf版本 下面是我正在使用的模板结构,
你好,我试图学习野蝇和springboose一个非常简单的应用程序使用eclipse。项目名称是springboo-test。包括主方法类在内的所有类都在同一个包中。 主方法类称为'App',其代码如下: 以下是服务器日志: 11:36:57281信息[org.wildfly.extension.undertow](服务器服务线程池--68)WFLYUT0021:注册的web上下文:'/sprin
在设置到数据库的连接时出现,并在服务器上的日志文件夹中查看文件error_log,我看到。 谁能告诉我,我是否遗漏了一些必要的步骤,或者问题出在哪里?
我试图使一个API工作在springstart但是当我输入请求:http://localhost:8080/employee/all我得到这个结果: 它是一个经典的服务,包含一个模型、一个服务、一个存储库、一个映射器和一个异常(如果没有员工),使用的数据库是sql中的实体,如下所示 服务: 仓库 模型 制图员 例外 波姆。xml