2015-07-22 53 views
1

我使用這個庫thymeleaf-layout-dialectThymeleaf問題的CSS?

我的佈局方言....

 <!DOCTYPE html> 
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"> 
    <head> 
      <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> 
      <title layout:title-pattern="$DECORATOR_TITLE - $CONTENT_TITLE">NextInfo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> 
      <link rel="stylesheet" type="text/css" href="../../../resources/css/animate.css" th:href="@{'resources/css/animate.css'}"/> 
      <link rel="stylesheet" type="text/css" href="../../../resources/css/semantic.min.css" th:href="@{'resources/css/semantic.min.css'}"/> 
    </head> 
    <body> 
     <div class="ui stackable blue inverted menu"> 
       <a class="right item "> 
        <i class="home icon"></i> 
        Inicio 
        </a> 
       <a class="item"> 
        <i class="phone icon"></i> 
        Telefones 
        </a> 
        <a class="item"> 
        <i class="mail Outline icon"></i> 
        Email 
        </a> 
        <a class="item"> 
        <i class="chat icon"></i> 
        Suporte 
        </a> 
        <div class="ui category search item" style="margin-right:40px"> 
        <div class="ui transparent icon input"> 
         <input class="prompt" type="text" placeholder=" pesquisar ..." /> 
         <i class="search link icon"></i> 
        </div> 
        <div class="results"></div> 
       </div> 
     </div> 
     <div id="header" layout:fragment="header"></div> 
     <div id="content" layout:fragment="content"></div> 
     <div id="footer" layout:fragment="footer"></div> 
     <script src="../../../resources/js/jquery.min.js" data-th-src="@{resources/js/jquery.min.js}"></script> 
     <script src="../../../resources/js/semantic.min.js" data-th-src="@{resources/js/semantic.min.js}"></script> 
    </body> 
    </html> 

我創建了一個佈局如圖所示鏈接

我家的控制器

@Controller 
@RequestMapping(value ={"/","/home"}) 
public class Principal { 

private final static String URLINICIAL = "index"; 

@RequestMapping(value ={"/","/home"} ,method=RequestMethod.GET) 
public String requisicaoPadrao() { 
    return URLINICIAL; 
} 
@ResponseBody 
@RequestMapping(value = "/testes", method=RequestMethod.GET) 
public <T> Object testes() { 
    return null; 
} 
} 

指數.html

<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorator="/templates/layouts/default"> 
    <head> 

    </head> 
<body> 
<div layout:fragment="header"><h1>index</h1></div> 
<div layout:fragment="content"></div> 
</body> 
</html> 

創建新視圖

<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorator="/templates/layouts/default"> 
    <head> 
    <title>testPage</title> 
    </head> 
<body> 
<h1>teste</h1> 
    <div layout:fragment="header"><h1>testPage</h1></div> 
    <div layout:fragment="content"></div> 
</body> 
</html> 

新控制器
我需要@RequestMapping註釋類以上。

@Controller 
    @RequestMapping("/test") 
    public class TestController { 

     @RequestMapping(value = "/", method=RequestMethod.GET) 
     public String index(){ 
      return "testpage"; 
     } 

    } 

正如你可以看到它行不通.... 如何解決?

回答

1

我設法解決只憑這
<script src="../../../resources/js/jquery.min.js" data-th-src="@{resources/js/jquery.min.js}"></script>

<script src="/web/resources/js/lib/jquery.min.js"></script> 

我沒有使用的特定標籤thymeleaf

改變