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

Uh-oh. She’s right...

Think about what we did. We made a page for the header, “Header.jsp”. It was a nice JSP all on its own, complete with its opening and closing HTML and BODY tags. Then we made the “Contact.jsp” and it, too, had nice opening and closing tags. Well, didn’t we say that everything in the included file is pasted (virtually) into the page with the include? That means everything.

image with no caption

The code below, from the generated servlet, will NOT work in all browsers. It worked in ours because we got lucky.

image with no caption

Note

Do NOT put opening and closing HTML and BODY tags within your reusable pieces!

Design and write your layout template chunks (like headers, nav bars, etc.) assuming they will be included in some OTHER page.

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