| Author |
Data in textarea is being interpreted as HTML by browser
|
Tom Katz
Ranch Hand
Joined: Aug 19, 2002
Posts: 169
|
|
I've got a JSP that's displaying any/all kinds of file data in a text area. Well, I just ran up against the occurrence where this file might be in xml-format, and it gets interpreted as HTML. What results is the </textarea> tag and everything below it is commented out. Anyone seen this or know of a way to prevent a textarea from allowing this? thanks
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
escape your server side code returned from the database. change all of the < to ↦lt; and > to > Eric
|
 |
Tom Katz
Ranch Hand
Joined: Aug 19, 2002
Posts: 169
|
|
thanks... I was just trying that with string.replaceAll("<", ">"), etc. Didnt seem to work, better check and make sure I'm doing it right ))
|
 |
Tom Katz
Ranch Hand
Joined: Aug 19, 2002
Posts: 169
|
|
Oops that came out looking wrong because the < was interpreted as html. When I run the replaceAll on the string, it looks the same. Turns out though, removing a valid html comment below the textarea may have fixed this problem. Still got me worried tho... thanks again
|
 |
Ayan Kumar Roy
Greenhorn
Joined: Aug 21, 2002
Posts: 10
|
|
|
Can u please post the code?
|
Ayan Kumar Roy.<br />India
|
 |
 |
|
|
subject: Data in textarea is being interpreted as HTML by browser
|
|
|