Java Servlets   «Prev  Next»

Lesson 6Server-side Technologies
ObjectiveServer Side Include

Server-side Technologies and Server Side Include

What is SSI?

Describe what Server Side Include is and what it is used for.
SSI stands for server side include.
They allow you to include one piece of HTML within another.
For example, you might have a standard footer at the bottom of all your pages with a copyright notice and an email link to your own address.
To include this in all your pages, you would add this tag at the bottom:
<!--#include file="FOOTER.HTML" -->

Then when another new year rolls around, you can simply edit FOOTER.HTML to mention the current year in the copyright statement, rather than changing every page.

Server side includes execs

But server side includes do far more than just include plain HTML. You can also run a program on the server.
That program will write out HTML, and the Web server will replace your tag with the output of the program. Here’s an example:
<!--#exec cmd="request.cgi 14 Feb" -->

After the program name (request.cgi in this example) come any arguments the program takes.
The program that you run on the server can be a Perl script, or a compiled program written in any language you choose, even Java.
Using server side includes in this way can make your site easier to maintain. For example, one person who is skilled in HTML can develop most of the page, just sticking the INCLUDE tag in where appropriate. Changing the look of your site will not require any work from a programmer, since no CGI program will have to be changed. However, it is just as hard to maintain state in this way as it is with CGI.
Many Internet hosting sites do not support EXEC INCLUDES because they can pose a security risk, or crash the Web server if they are written poorly.

Learn about Active Server Pages (ASP) from Microsoft in the next lesson. ASP