Ricky V.
Ricky V.

Reputation: 139

springboot thymeleaf html create link

I have this springboot thymeleaf html,

    @GetMapping("/rest")
    public String list(Model theModel) {

        // add to the spring model
        theModel.addAttribute("list", theModel);

        return "menu-list";
    }

menu-list.html,

        <tbody>
            <tr th:each="List : ${list}">
            
                <td th:text="${list.name}" />   
                <td th:text="${list.position}" />   
                <td th:text="${list.homepage}" />
                
            </tr>
        </tbody>        

I need to put link on the, td th:text="${list.homepage}". Like href=www.mydomain.com.

I have no idea what to do?

Upvotes: 0

Views: 96

Answers (1)

Andrian Soluk
Andrian Soluk

Reputation: 474

Can you please try to use the following code:

<td><a th:href="@{${list.homepage}}" th:text="homepage"/></td>

Upvotes: 2

Related Questions