【问题标题】:thymeleaf: processing attributes of elementsthymeleaf:处理元素的属性
【发布时间】:2015-09-24 11:55:54
【问题描述】:

在我当前的 spring-boot 项目中,我实现了一个 AbstractTextChildModifierAttrProcessor 类来处理这样的标签:

<p get:property="xxx,yyy"></p>

它被处理成那个:

<p>zzz</p>

但现在我正在寻找类似的东西,但要与标签 th:if&lt;a&gt; 一起使用,如下所示:

th:if="..."

<a th:href="..."></a>

自定义处理器应放置为标签的属性,并为该属性返回一个文本值。

有人可以给出关于如何做到这一点的提示,使用相同的处理器 AbstractTextChildModifierAttrProcessor 还是另一个?

【问题讨论】:

    标签: spring attributes spring-boot thymeleaf processor


    【解决方案1】:

    href 属性我通过使用类得到一个解决方案:

    AbstractAttributeModifierAttrProcessor
    

    在我使用的视图中:

    get:href="Suporte,faq"
    

    th:if 标签我能够在类中得到类似的结果:

    AbstractConditionalVisibilityAttrProcessor
    

    在我使用的视图中:

    get:if="Suporte,faq"
    

    链接:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多