小编bra*_*zen的帖子

如何防止thymeleaf替换HTML属性值中的特殊字符?

我将Thymeleaf与js微模板程序结合使用,从而在属性值中产生特殊字符.在运行Thymeleaf时

<a style="display:<%= x ? 'block' : 'none' %>;">
Run Code Online (Sandbox Code Playgroud)

它创建

<a style="display:&lt;%= x ? &#39;block&#39; : &#39;none&#39; %&gt;;">
Run Code Online (Sandbox Code Playgroud)

虽然我希望得到与处理器完全相同的功能.如何在HTML属性值中使用特殊字符?非常感谢!

template-engine thymeleaf

6
推荐指数
2
解决办法
7888
查看次数

Spring Web MVC 3.1.1参数解析器在拦截器之前调用

我正在配置我的Spring MVC 3.1.1应用程序,如下所述.记录显示在'MyInterceptor.preHandle'之前调用'MyArgumentResolver.resolveArgument'.当在旧时配置中使用它们(使用明确定义的AnnotationMethodHandlerAdapter bean等)时,它们被调用,反之亦然.我读到<mvc:annotation-driven>在某种程度上是关键的,因为它的配置不能补充mvc:namespace的其他设置.我面临同样的问题吗?

<mvc:annotation-driven>
  <mvc:message-converters>
   ...
  </mvc:message-converters>     
  <mvc:argument-resolvers>
    <bean class="[...].MyArgumentResolver"/>
  </mvc:argument-resolvers>    
</mvc:annotation-driven>
<mvc:interceptors>
  <mvc:interceptor>       
    <mvc:mapping path="/home/**" />
    <bean class="[...].MyInterceptor" />
  </mvc:interceptor>
</mvc:interceptors>
Run Code Online (Sandbox Code Playgroud)

非常感谢!

spring spring-mvc

2
推荐指数
1
解决办法
5644
查看次数

标签 统计

spring ×1

spring-mvc ×1

template-engine ×1

thymeleaf ×1