O'Reilly logo

Head First Servlets and JSP, 2nd Edition by Bert Bates, Bryan Basham, Kathy Sierra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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?

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required