小编Ami*_*tim的帖子

春季靴子百里香的图像

我正在尝试为sendind电子邮件开发spring boot应用程序.一切都还可以但是在模板百里香中,当我尝试添加图像时显示错误.这是我的template.html的片段

 <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title th:remove="all">Order Confirmation</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<div>

    <h2 th:text="${title}">title</h2>
    <p th:utext="${description}">
            description
    </p>

    <br />
    <br />
    <br />
    <p>Bien cordialement</p>
    <div>
        <img th:src="@{/img/signature.png}" />

    </div>
</div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是错误:

 ERROR [[/jira-rct/v1.0].[dispatcherServlet]] [http-nio-8080-exec-1] Servlet.service() for servlet [dispatcherServlet] in context with path [/jira-rct/v1.0] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateProcessingException: Link base "/img/crm-signature.png" cannot be context relative (/) or page relative unless you implement the org.thymeleaf.context.IWebContext interface (context is …
Run Code Online (Sandbox Code Playgroud)

email spring thymeleaf spring-boot

6
推荐指数
1
解决办法
5344
查看次数

在Thomleaf模板中使用src图像内部的变量

我在我的视图中使用spring-boot和thymeleaf作为模板开发了一个应用程序我尝试在循环中使用变量但是它没有用.这是我的代码片段:

<table >
    <thead>
        <tr>
            <th>Type</th>
            <th>Résumé</th>
            <th>Contenu</th>
        </tr>
    </thead>
    <tbody>
        <tr th:each="subTask  : ${lstOtherSubTasks}">
            <td><img th:src="@{/img/icons/${subTask.issueTypeId}.png}" title="TODO" />     // here the variable ${subTask.issueTypeId} not works
            <p th:text="${subTask.issueTypeId}" />   here the value of the variable ${subTask.issueTypeId} is not null I get the good value 
            </td>
            <td th:text="${subTask.resume}"></td>
            <td th:text="${subTask.contenu}"></td>
        </tr>
    </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

thymeleaf spring-boot

3
推荐指数
1
解决办法
8089
查看次数

标签 统计

spring-boot ×2

thymeleaf ×2

email ×1

spring ×1