本文介绍了在百里香叶中设置变量名的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的百里香,并且正在将ma网页从jsp转换为百里香。我有一个像这样的标签标签

 < c:set var =someVariablevalue =$ {someValue}/ > 

这个变量可以在jsp的任何地方使用。有没有这样的替代品在thymeleaf?

解决方案

您可以使用。

声明一个HTML元素一个 th:带属性。例如

 < div th:with =someVariable = $ {someValue}> 

文档状态


包含标签的b $ b。

I am new to thymeleaf and am converting ma web page from jsp to thymeleaf. I have a strut tag like this

<c:set var="someVariable" value="${someValue}"/>

which that the variable can be used anywhere in jsp. Is there any such alternatives for this in thymeleaf?

解决方案

You can use local variables.

Declare an HTML element with a th:with attribute. For example

<div th:with="someVariable=${someValue}">

The documentation states

这篇关于在百里香叶中设置变量名的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-21 06:22