Tag thymeleaf

4 respostas
A

Ola pessoa! Estou tentando criar um simples projecto usando Spring boot, mas so que nao consigo usar a tag thymeleaf, quando eu fizer th: alguma coisa, nao aparece. Lembrando que ja coloquei as dependencias dele no projecto.

<dependencies>
    
    <!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf-spring4 -->
    <dependency>
        <groupId>org.thymeleaf</groupId>
        <artifactId>thymeleaf-spring4</artifactId>
        <version>3.0.9.RELEASE</version>
    </dependency>

    
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    
    <!-- https://mvnrepository.com/artifact/org.webjars/webjars-locator -->
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>webjars-locator</artifactId>
        <version>0.32</version>
    </dependency>

            
    <!-- https://mvnrepository.com/artifact/org.webjars/bootstrap -->
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>bootstrap</artifactId>
        <version>3.3.7</version>
    </dependency>
    
    <!-- https://mvnrepository.com/artifact/org.webjars/jquery -->
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>jquery</artifactId>
        <version>2.2.1</version>
    </dependency>


</dependencies>

4 Respostas

D

Declarou o namespace?
Este é um bom exemplo.

A
<!DOCTYPE html>
Lista de Convidados

Lista de convidados

Adicionar
<table class="table">
                <thead>
                    <tr>
                        <th>Nome</th> 
                        <th>Acompanhantes</th> 
                    </tr> 
                </thead> 
                <tbody> 
                    <tr th:each="convidado : ${convidados}"> 
                        <td th:text="${convidado.nome}"> </td> 
                        <td th:text="${convidado.quantidadeAcompanhantes}"></td> 
                    </tr>
                </tbody> 
            </table> 
        </div> 
    </div> 

</body>
A

Estas a referir a isto

<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:th="http://www.thymeleaf.org">
A

ja declarei mas nao aparece

Criado 11 de maio de 2018
Ultima resposta 14 de mai. de 2018
Respostas 4
Participantes 2