Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strip_tags in JSP

Status
Not open for further replies.

tcardoso

Programmer
Jan 31, 2005
56
PT
Hi,

how can I strip the HTML tags in JSP to show in a page.

I want the text <b>bold<b> to be tranformed to &gt;b&lt;bold&gt;b&lt;

Thanks
 
If <pre> won't do what you want, a string replace probably will.
 
There is no function to change it? I will to build my own method?
 
myString.replaceAll("<", "&gt;").replaceAll(">","&lt;");
 
<code>
public class TestRemoveTag {
public static void main(String args[]) {
String s ="<b>hello</b>";
s = s.replaceAll("<.*?>","");
System.out.println(s);
}
}
</code>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top