How to include HTML in OGNL expression language in Struts 2

I am working on struts 2. I was making projection

collections in my JSP page using the OGNL expression language.

I have 1 list based collection in my class action

which I view in the JSP page like this:

<s:iterator value="lsEmp.{name + '<b>---</b>' + address}"> //lsEmp is a list based collection
<s:property /><br>
</s:iterator>

      

I need an output like this:

rajiv --- N. Delhi

nakul --- Mumbai

vinay --- Banglore

// "---" bold .

But my tag <b></b>

is <s:iterator value="">

not accepted. And this prints how it looks like this:

rajiv <b>---</b> N.Delhi

nakul <b>---</b> Mumbai

vinay <b>---</b> Banglore

      

I want to know if there is a way to include HTML in an OGNL expression.

+2


source to share


1 answer


You can turn off escape html characters when printing to



<s:property escapeHtml="false"/><br>

      

+1


source







All Articles