问题
I am working on struts 2. I was doing a projection
of a collection in my JSP page using OGNL expression language.
I have 1 list based collection in my action
class, that I am accessing on JSP page like this:
<s:iterator value="lsEmp.{name + '<b>---</b>' + address}"> //lsEmp is a list based collection
<s:property /><br>
</s:iterator>
I want the output like this:
rajiv --- N.Delhi
nakul --- Mumbai
vinay --- Banglore
//"---" being bold.
But my <b></b>
tag in <s:iterator value="">
is not getting accepted. And it is printing as it is like this:
rajiv <b>---</b> N.Delhi
nakul <b>---</b> Mumbai
vinay <b>---</b> Banglore
I want to know is there any way to enable HTML in OGNL expression.
回答1:
You can turn off escape html symbols when printing to out
<s:property escapeHtml="false"/><br>
来源:https://stackoverflow.com/questions/26684025/how-to-include-html-in-ognl-expression-language-in-struts-2