【发布时间】:2017-03-29 12:28:34
【问题描述】:
百里香是否可以检索输入的“生成”名称属性?
我需要创建一个 id 等于输入名称属性的 div。 输入名称通过 th:field 生成。
标记:
<input type="radio" id="winterTiresInstalled" th:field="*{winterTiresInstalled.value}" />
生成的标记:
<input id="fld_winterTires" type="radio" name="vehicle.winterTiresInstalled.value" />
我想要什么:
<div th:id="???" />
获得:
<div id="vehicle.winterTiresInstalled.value" />
那么,如何使用 thymleaf 检索生成的名称属性值“vehicle.winterTiresInstalled.value”?
我可以在 js 中做,但我更喜欢在我的模板中做。
谢谢。 大卫
【问题讨论】:
-
name属性好像是由类SpringInputRadioFieldAttrProcessor.doProcess方法生成的(String name = bindStatus.getExpression();)。我们如何检索 thymeleaf 中的 spring-mvc bindStatus ?
-
使用 thymeleaf 2.1.4.RELEASE 和 spring-mvc 4.3.3.RELEASE
标签: spring-mvc thymeleaf