我在图书列表数组 (booklist) 上迭代并逐一设置书名。在这种情况下,我需要转义“t-6ren">
gpt4 book ai didi

java - Struts tags

转载 作者:搜寻专家 更新时间:2023-10-31 08:29:50 24 4
gpt4 key购买 nike

如何在 struts 标签中转义像 '&' 这样的字符。例如我们可以提到。

<a href="./testaction.do?testmethod=bookResult&bookTitle=<bean:write name="booklist" property="title"/>" class="nLink"><bean:write name="booklist" property="title"/></a></small>

我在图书列表数组 (booklist) 上迭代并逐一设置书名。在这种情况下,我需要转义“title”属性中的“&”等字符,以便执行该特定的相应逻辑行动。

谢谢。

最佳答案

也许使用 filter属性?

<bean:write name="booklist" property="title" filter="true" />

更多关于 <bean:write> .文档指出:

If this attribute is set to true, the rendered property value will be filtered for characters that are sensitive in HTML, and any such characters will be replaced by their entity equivalents.

关于java - Struts <bean :write> tags,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4397648/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com