Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter bootstrap 我如何摆脱特殊字符'#';在百里香中th:attr_Twitter Bootstrap_Spring Mvc_Template Engine_Thymeleaf - Fatal编程技术网

Twitter bootstrap 我如何摆脱特殊字符'#';在百里香中th:attr

Twitter bootstrap 我如何摆脱特殊字符'#';在百里香中th:attr,twitter-bootstrap,spring-mvc,template-engine,thymeleaf,Twitter Bootstrap,Spring Mvc,Template Engine,Thymeleaf,我使用特殊字符“#”,如下所示: th:attr="data-target=#my_modal_+${myObject.id}" 由于特殊字符“#”,此操作失败并出错 无法作为分配序列进行分析 如果我删除“#”,它不会抛出错误,但不会按预期工作。在HTML中将id=“my_modal”更改为class=“my_modal” 然后你可以做类似的事情 th:attr="data-target=.my_modal_+${myObject.class}" 通过使用CSS中使用“.”而不是“#”的类,

我使用特殊字符“#”,如下所示:

th:attr="data-target=#my_modal_+${myObject.id}"
由于特殊字符“#”,此操作失败并出错

无法作为分配序列进行分析

如果我删除“#”,它不会抛出错误,但不会按预期工作。

在HTML中将id=“my_modal”更改为class=“my_modal”

然后你可以做类似的事情

th:attr="data-target=.my_modal_+${myObject.class}"

通过使用CSS中使用“.”而不是“#”的类,有望解决这个问题。

找到了解决方案,需要在#my#u modal周围加上引号_

th:attr="data-target='#my_modal_'+${myObject.id}"