Alex Rivera | Logout

JSP output string with HTML?

Asked 2012-02-22T06:43:36.827
9

I would like to output a string in a JSP page. The string contains HTML tag. How do I display the HTML version of the string in JSP?

e.g.

            `String str = "<b><u>bold and underlined</u></b>"`;

In JSP, I use <%=str%>

Instead of displaying the HTML version of the string (with bold and underlining of the text), the above string is displayed. Can you help?

I also tried

                   <% out.print(str); %>

But didnt worked for me.

Edit
Report

1 Answer

2

don't know weather this helps..

By entering the string in the following manner allows you to show the code in a text area...

 String str = "<textarea><b><u>bold and underlined</u></b></textarea>";  
answered 2012-02-22T07:07:27.097

Your Answer