2015-07-24 12 views
5

Il controllo HTML di Netbeans non piace il mio spazio dei nomi di thymeleaf.Lo spazio dei nomi di Thymeleaf nei file html mostra errori in Netbeans - Come posso farlo passare il controllo HTML?

Ecco il mio HTML Thymleaf il file:

<!DOCTYPE html> 
<html xmlns:th="http://www.thymeleaf.org"> 
<head th:fragment="head"> 
    <object th:include="fragments/meta :: meta" th:remove="tag" /> 

    <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Open+Sans:300italic,400,300,700' rel='stylesheet' type='text/css'/> 

    <link href="/../../../webjars/Semantic-UI/2.0.6/semantic.min.css" rel="stylesheet" th:href="@{/webjars/Semantic-UI/2.0.6/semantic.min.css}"/> 
    <link href="../../../css/core.css" rel="stylesheet" th:href="@{/css/core.css}" /> 
    <link href="../../../css/product.css" rel="stylesheet" th:href="@{/css/product.css}" /> 

    </head> 
<body> 

</body> 
</html> 

Questo è l'errore visualizzato in Netbeans:

enter image description here

Come posso ottenere Netbeans di giocare bene con Thymeleaf?

+2

Visualizza errori in Eclipse? Sto usando ' 'senza problemi. – Incognito

+0

l'aggiunta di 'xmlns =" ​​http://www.w3.org/1999/xhtml "' ha funzionato per la maggior parte degli errori ma non per ' ' – cosbor11

+0

Deve essere' '? C'è qualcosa come 'th: block' in Thymeleaf. http://www.thymeleaf.org/whatsnew21.html#bloc – Incognito

risposta

6

Provare a risolvere il problema in questo modo si può ignorare la sicurezza di primavera.

<!DOCTYPE html> 
    <html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:th="http://www.thymeleaf.org" 
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"> 
    <head> 
     <meta charset="utf-8"/> 
     <title>Sample</title> 
     <link th:href="@{/resources/css/bootstrap.css}" rel="stylesheet" type="text/css"/> 
     <link th:href="@{/resources/css/bootstrap-theme.css}" rel="stylesheet" type="text/css"/> 
</head> 
1

ho scoperto come disattivare questi errori quando stavo facendo questo spring security tutorial

Semplicemente aggiungendo questo al tag html:

xmlns="http://www.w3.org/1999/xhtml" 

ciò che è ancora più interessante, NetBeans tracce ora se avete chiuso ogni tag con barra "/" nel documento.

Problemi correlati