How to un-escape HTML tags in JSP/Struts

J

John

Hi,
I receive from the database HTML formatted Strings like that:

<b>Currently results</b>

Using the <bean:message> struts tag, I expect to display it on the
generated JSP page in bold. But, for some reason, the browser really
displays

<b>Currently results</b>

The source code is of course

&lt;b&gt;Current results&lt;/b&gt;

So, somewhere happens a conversion, but I do not know where; I saw,
that before calling the <bean:message> tag, the string is still with
the formatted tags, which is ok.

Can somebody tell me what am I doing wrong? Do you have some example
that works?

Thank you very much for your help,
John
 
M

Mark Space

John said:
The source code is of course

&lt;b&gt;Current results&lt;/b&gt;

Have you looked in the database to see what is stored there? So you are
certain that the field contains <'s and >'s?

Show us the methods you use to retrieve this field from the database,
and the methods you use to send it to the client. An SSCCE would be ideal.
 
T

Tim B

John said:
Hi,
I receive from the database HTML formatted Strings like that:

<b>Currently results</b>

Using the <bean:message> struts tag, I expect to display it on the
generated JSP page in bold. But, for some reason, the browser really
displays

<b>Currently results</b>

The source code is of course

&lt;b&gt;Current results&lt;/b&gt;

So, somewhere happens a conversion, but I do not know where; I saw,
that before calling the <bean:message> tag, the string is still with
the formatted tags, which is ok.

Can somebody tell me what am I doing wrong? Do you have some example
that works?

Thank you very much for your help,
John


try setting the filter attribute of the bean:message tag to false:

<bean:message key="message.with.html" filter="false"/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top