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.
The code below, from the generated servlet, will NOT work in all browsers. It worked in ours because we got lucky.
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.