Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

How to un-escape HTML tags in JSP/Struts

Thread view: 
John - 07 Mar 2008 14:10 GMT
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
Roedy Green - 07 Mar 2008 23:13 GMT
On Fri, 7 Mar 2008 06:10:40 -0800 (PST), John
<gundam.f0rtre55@bluebottle.com> wrote, quoted or indirectly quoted
someone who said :

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

To convert those entities back to text, see
http://mindprod.com/products1.html#ENTITIES

to stop Struts from quoting them in the first place, you would have to
ask someone else.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Mark Space - 08 Mar 2008 04:17 GMT
> 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.
Tim B - 09 Mar 2008 20:37 GMT
> Hi,
> I receive from the database HTML formatted Strings like that:
[quoted text clipped - 20 lines]
> 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"/>
Arne Vajhøj - 09 Mar 2008 23:11 GMT
>> Hi,
>> I receive from the database HTML formatted Strings like that:
[quoted text clipped - 18 lines]
>
> <bean:message key="message.with.html" filter="false"/>

Does bean:message have filter ?

http://struts.apache.org/1.3.8/struts-taglib/tagreference.html#struts-bean.tld
indicates not (and that it may be necesarry to switch to bean:write).

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.