2014-11-28 3 views
3

스프링 부트 프로젝트에 맞춤 태그를 추가하면 thymeleaf 기반 파일에서 사용할 수 있습니까? 내가 가진 경우 예를 들어,이 태그는 내 TLD 파일에 정의 (디렉토리/src에있는 장소를/주/자원/정적) :thymeleaf에서 맞춤 태그 사용하기

<tag> 
    <name>Input</name> 
    <tag-class>org.store.custom.taglib.form_control.InputTag</tag-class> 
    </tag> 

나는 그런 내 생각이 사용할 수 마십시오

<p th:case="'Input'"><f:Input/></p> 

가능한지 누구나 알고 계십니까?

UPDATE

난 그 노력하지만, 내가 응용 프로그램을 실행할 때, 사용자 정의 태그는 해당 태그에 처리되지 않습니다 :

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="/form.tld" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"> 
<head> 
    <title>cadastro</title> 
</head> 
<body> 
    <div class="panel panel-default"> 
    <div class="panel-heading"> 
     <h3 class="panel-title">cadastro</h3> 
    </div> 
    <div class="panel-body"> 
     <f:form th:attr="[email protected]{/__${command.getClass().getSimpleName()}__/cadastra}"> 
     <div th:each="item : ${command['class'].declaredFields}"> 
      <div th:each="item2 : ${item.declaredAnnotations}"> 
      <div th:switch="${item2.annotationType().simpleName}" th:with="index=${itemStat.index}"> 
       <p th:case="'Checkbox'"><f:Checkbox/></p> 
       <p th:case="'DataList'"><f:DataList/></p> 
       <p th:case="'Input'"><f:Input/></p> 
       <p th:case="'Radiobutton'"><f:Radiobutton/></p> 
       <p th:case="'Select'"><f:Select/></p> 
       <p th:case="'Textarea'"><f:Textarea/></p> 
      </div> 
      </div> 
     </div> 
     </f:form> 
    </div> 
    </div> 
</body> 
</html> 

답변

2

번호 Thymeleaf의 기본 원칙은 그 어떤 외국인 태그입니다 존재해야한다. (표준 html 만). 모든 동적 컨텐츠는 사용자 정의 속성을 통해 추가됩니다.