0

I'm using springboot and thymeleaf to map to display data from my database on an html page.

<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8" />
<title></title>
<link rel="stylesheet" type="text/css" th:href="@{/assets/style.css}" />

</head>
<body>
    <p th:text="${title}"></p>

    <a href="/newPost">Create a new Post</a>
    <a href="/newComment">Create a new Comment</a>


    <table>
        <tr th:each="post : ${posts}">
            <td th:text="${post.creationDate}"></td>
            <td th:text="${post.titel}"></td>
            <td th:text="${post.content}"></td>
            <td><a th:href="@{/newComment(postId=${post.id})}">new Comment</a></td>
            <td th:text="${post.comments}"></td>
            <td><img th:src="${post.bild}"></td>
        </tr>
    </table>

HeidiSQL

I used DTOs to map the entities, however when display the actual html page the image is not displayed(404 Error), even though the link is showing up when i inspect the tag.enter image description here

Am i missing something obvious? Isn't this an easy way to display images on my page, if i don't want to convert them to a bytestream? I'm guessing you need more information, but i don't know which would be helpful. Any help appreciated!

quizz
  • 7
  • 2

1 Answers1

0

It's not possible to access local filesystem from a webpage that runs on a web server. See this answer for details.