A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Frameworks
»
Struts
Author
Outputting html text
Andy Holm
Ranch Hand
Joined: Jul 03, 2008
Posts: 86
posted
Feb 10, 2010 08:42:15
0
I have bean values that have html markup as part of the value. How do I display that html in
struts
without having the markup tags be outputted explicitly? In other words, I want the html to be rendered by the browser.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
Feb 10, 2010 10:31:59
0
How are you outputting them now? Just don't escape them?
Andy Holm
Ranch Hand
Joined: Jul 03, 2008
Posts: 86
posted
Feb 10, 2010 12:17:11
0
Right now the legacy application outputs the values with a <bean:write>. In the database, the field values are things like:
Test
Value
When it is outputted, the source of the web page shows:
<b>Test Value</b>
This all happens as part of the <bean:write> output. Is there another call I should be using?
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
I like...
posted
Feb 10, 2010 12:23:09
0
http://struts.apache.org/1.2.x/userGuide/struts-bean.html#write
See the "filter" attribute. The documentation is your friend--read it early and often.
Note that simply setting it to false without any other back-end cleanup exposes the page to scripting attacks.
I agree. Here's the link:
http://aspose.com/file-tools
subject: Outputting html text
Similar Threads
org.w3c.dom.Document - output without escaping markup
How to create a video virtual tour player on my JSP page.
[Solved] Unexpected behaviour of HTML
JSP Action Buttons freez after returning from ajax call
& in URL query String
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter