Struts< bean:write>标签 [英] Struts <bean:write> tags

查看:193
本文介绍了Struts< bean:write>标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How do I escape character like '&' in struts tags. For example we can mention.

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

我正在迭代图书清单数据(书单)并逐一设置图书标题。在这种情况下,我需要在'title'属性中转义'&'之类的字符,以便为该特定操作执行相应的逻辑。

I'm iteration over a book list array (booklist) and setting book titles one by one.In this scenario I need to escape characters like '&' within the 'title' property in order execute the respective logic for that particular action.

谢谢。

推荐答案

也许使用过滤器属性?

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

更多关于 < bean:write> 。文档说明:

More on <bean:write>. The documentation states:


如果此属性设置为 true
对于HTML中敏感的
字符,呈现的属性值将为
,并且任何此类
字符将被其
实体等价物替换。

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.

这篇关于Struts&lt; bean:write&gt;标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆