Boa-noite.
Estou com o seguinte problema:
Estou usando o Spring juntamente com o MaterializeCSS. Fiz oque foi requisitado pelo site para a instalação do MaterializeCSS, entretanto minha request para o link “/registrar/cliente” (registerClient.html) não identifica o Materialize (não fica customizado). Mas, o meu “/” (index.html) fica corretamente formatado. Se eu mudar a request “/registrar/cliente” para somente “/registrarcliente” o MaterializeCSS reconhece. Alguém tem ideia do que pode ser?
Segue os arquivos:
Application.java (só pra descargo de consciência)
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication
@EnableJpaRepositories(basePackages = "app.repository")
@ComponentScan(basePackages = "app.controller")
@EnableTransactionManagement
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
index.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<!-- Head -->
<head>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
<link type="text/css" rel="stylesheet" href="materialize/css/materialize.min.css" media="screen,projection"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta charset="utf-8">
</head>
<!-- Body -->
<body>
<nav>
<div class="nav-wrapper">
<a href="/" class="brand-logo">Teste</a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="/registrar/cliente" class="waves-effect waves-light btn">Registrar Cliente</a></li>
</ul>
</div>
</nav>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="materialize/js/materialize.min.js"></script>
</body>
</html>
IndexController.java
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller("indexController")
public class IndexController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index() {
return "app/index";
}
}
registerClient.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<!-- Head -->
<head>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
<link type="text/css" rel="stylesheet" href="materialize/css/materialize.min.css" media="screen,projection"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta charset="utf-8">
</head>
<!-- Body -->
<body>
<nav>
<div class="nav-wrapper">
<a href="/" class="brand-logo">Teste</a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="/registrar/cliente" class="waves-effect waves-light btn">Registrar Cliente</a></li>
</ul>
</div>
</nav>
<h1>Cadastrar Cliente:</h1>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="materialize/js/materialize.min.js"></script>
</body>
</html>
ClientController.java
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller("clientController")
public class ClientController {
@RequestMapping(value = "/registrar/cliente", method = RequestMethod.GET)
public String form() {
return "crud/client/registerClient";
}
}