struts標簽的filter屬性
有些存儲在數(shù)據(jù)庫或者某些文件的信息,可能會包含一些 html 標記的限定。例如把某句話加粗等。但是簡單的使用 <bean:write name=”” /> 會把那些 html 標記給安全的轉(zhuǎn)換,但這不是我想要的。怎么解決,發(fā)現(xiàn)了 filter 這個屬性。應(yīng)用如下:
在 Action 中我寫入這樣對象:
String html_1 = "<b>Hello</b>";
String html_2 = "<b>Hello</b>";
在 Jsp 中我這樣使用:
<bean:write name="html_1" filter="true"/>
<bean:write name="html_2" filter="false"/>
運行的效果:
<b>Hello</b>
Hello
posted on 2006-10-17 22:30 白洋 閱讀(751) 評論(0) 編輯 收藏 所屬分類: Struts 知識點滴