如何在 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/