I have a java bean which get populated from DB. The fields of bean may contain characters like < or . Right now when i am trying to display them, the string get truncated from the point where any of these character appear.
So if i have
this is a </ test message and i want to see if it displays. HTML will display only this is a string only. How can i display full string.
P.S:
For some reasons, I can’t change string in the database. I have to rely whatever i have in db.
For a simple solution, see methods of the
Stringclass:Note: replaceAll and replaceFirst require a regex pattern to match, not a plain match string. Check
Patternclass on how to build a suitable regex.Remember that in HTML, the symbols < and > can be displayed using
<and>. If you don’t understand what I’m talking about, just View Source on this page and find my last sentence in the source.