有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java thymeleaf布局方言TemplateProcessingException:执行处理器的nz时出错。网ultraq。百里香。装饰师。装饰处理器

背景

我正在使用spring web 4.3.4thymeleaf 2.1.5layout dialect 1.4.0。我使用xml配置而不是Java配置

我的上下文配置如下:

<bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
    <property name="prefix" value="/WEB-INF/views/"/>
    <property name="suffix" value=".html"/>
</bean>

<bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
    <property name="templateResolver" ref="templateResolver"/>
    <property name="templateEngineMessageSource" ref="messageSource"/>
    <property name="additionalDialects">
        <set>
            <bean class="nz.net.ultraq.thymeleaf.LayoutDialect"/>
        </set>
    </property>
</bean>

<bean id="viewResolver" class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
    <property name="templateEngine" ref="templateEngine"/>
    <property name="order" value="1"/>
</bean>

如果我不使用任何布局特性,包括@{...}加载静态资产,使用th:replace替换片段,它就可以正常工作。但是,当我尝试使用layout:decoratorhere运行示例时,它不起作用

我的文件结构:

  • WEB-INF
    • 资产
      • js
      • css
    • 观点
      • 内容1。html
      • 布局。html

我发现由于this的原因layout:decorator上可能存在一些问题。因此,我尝试了以下案例,但没有成功

  • layout:decorator="Layout"
  • layout:decorator="/Layout"
  • layout:decorator="~{Layout}"
  • layout:decorator="~{/Layout}"
  • layout:decorator="'Layout'"
  • layout:decorator="'/Layout'"
  • layout:decorator="'~{Layout}'"
  • layout:decorator="'~{/Layout}'"

问题

  • 我的上下文xml设置正确吗
  • 我的layout:decorator设置正确吗
  • 如果不是,正确的情况应该是什么


谢谢你的帮助。谢谢你的帮助


共 (0) 个答案