EL renders raw text, including HTML

The mystery is solved when you look at the actual HTML that is generated...

image with no caption

So, the “<b></b>” portion of the tip is being sent in the output stream, but the web browser is simply rendering it as raw HTML—by bolding an empty space on the page.

So, of course the user does not see the “<b></b>” tags on the screen.

The same is true for JSP expression tags...

image with no caption

... and for the jsp:getProperty standard action

image with no caption

Flex Your Mind

OK, so the tip string is being sent to the output stream, but Documents-R-Us wants to convert HTML special characters into a format that is rendered properly in their tips. So we want to send “&lt;” in order for the user to see the actual < character in the browser, and “&gt;” to produce the > character.

How would you accomplish this?

Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.