Description
I am using Springboot and thymeleaf with mysql. I am querying company data from mysql and populating a table using the results. Each column of the table is an attribute of a company, and there are 2 hyperlinks: one to the website of the company, and one to the page within my system for this company. Both of these links work:
This works (it shows me the website address as a url, I can actually click on it):
<a th:text="${c.getWebsite()}" th:href="${c.getWebsite()}"> Website </a>
This also works (the button is called "view" but the hyperlink works):
<a th:href="@{'/company/' + ${c.getId()}}" class="btn btn-primary"> <i class="fas fa-building"></i> View </a>
On column 3 of the table, there is the company name. I would like this name to be a hyperlink linking to my system's page for this company. And for some reason this does not work:
<a th:text="${c.getName()}" th:href="@{|/company/${c.getId()}|}">Name</a>
When I inspect the element, I see this :
<a href="/company/123456">Test Company</a>
So this seems correct, but it does not let me click on it. The browser does not recognize this as a link.
Note: the "company name" (that I want to turn into a url) is in column 3 of the table, then the website is a bit further; and finally the button "view" is in the last column. The button view works, and when I copy the code of that button to the third column without making any change, it stops working (it shows just the button, but no url is working, even though when I inspect the element, the url is there). It is very weird, I got that on both chrome and edge.
I am using the following version of Springboot:
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
(...)
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
<version>3.0.4.RELEASE</version>
</dependency>
(...)