Content between < and > cant be print in jsp

219 views Asked by At

I want to print some IRIs in a jsp page. When I use System.out.println to print the content into the system the result is fine e.g. http:blabla. However, when I use PrintWriter to print the content into the html page the result is an empty string.

1

There are 1 answers

4
Samuel Marchant On

If you want to see them in an html page (not as code) you require to print the symbols as "HTML entities". HTML entities start with an AMPERSAND symbol and end with SEMI COLON.

less than is [AMPERSAND]lt[SEMI COLON]

greater than is [AMPERSAND]gt[SEMI COLON]

If it is in a string in a programming language the symbol may need a \ backslash character to delimit it both in the string and for outputting by some print method.

If you printed to an html page right click on it and press "view page source" on the menu.