O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

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

Including Other Files

Splitting your code is one of the first techniques you can use to organize it. Many sites have a consistent header on every page. You can put the header into a separate file and include it in every page. When you need to change the header, you only need to change one file.

Within a Java Server Page, you can choose to include another file at page compile time or at runtime. The advantage of including a file at compilation time is performance. At runtime, the JSP engine doesn't need to do any work because the file has already been included. Unfortunately, the servlet engine can only include files at runtime. After all, you are the one who compiles the server—how could the servlet engine include something at compile time?

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