I’m currently trying to display the actual image instead of it’s URL using Java Spring, MySQL and Thymeleaf. I have a class that gets the url as a string from the database.
@Entity
@Table(name="person")
public class Person{
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private int id;
@Column(name="name")
private String name;
@Column(name="image")
private String image;
@Column(name="number")
private int number;
In the html form I have:
<table class="table table-bordered table-striped">
<thead class="thead-dark">
<tr>
<!-- table headings -->
<th>Name</th>
<th>Image</th>
<th>Number</th>
</tr>
</thead>
<tbody>
<!-- Looping over data -->
<tr th:each="person: ${person}">
<td th:text="${person.name}" />
<td th:text="${person.image}" />
<td th:text="${person.number}" />
<td>
</td>
</tr>
</tbody>
</table>
What thymeleaf expression or javascript code would I need to display the image at the url as opposed to just the URL string?