| |||||||||||
| |||||||||||
Running SSI (Server Side Include) scripts in Apache Tomcat
Server Side Includes provide the web user with a handful of facilities that can be included in their HTML pages, to be parsed out / completed by the server. For example, the date and time can be included in a web page using an SSI. Both httpd and Tomcat can support SSIs, provided that the server is configured to provide the support; where the configuration IS done, it's usual for an extension .sht or .shtml to be used. SAMPLE SSI SCRIPT Here's a sample "ssi" script that you might want to install on your Tomcat server: <head><title>Linux, Apache httpd, Tomcat, MySQL, Java</title></head> <body><h1>Linux, Apache httpd, Tomcat, MySQL and Java</h1> This is part of a sample web application that tests Tomcat deployment. <hr> Server side include - date is <!--#echo var="DATE_LOCAL" --> <hr> Page written by Well House Consultants Ltd, +44 (0) 1225 708225<br> web <a href=http://www.wellho.net>http://www.wellho.net</a><br> email <a href=mailto:info@wellho.net>info@wellho.net</a><br> </body> CONFIGURING TOMCAT TO SUPPORT SSI Although SSI support is shipped with the standard Tomcat load, the vital information that you'll need is commented out in the web.xml file and you need to uncomment the following to add in the support: <servlet> <servlet-name>ssi</servlet-name> <servlet-class> org.apache.catalina.ssi.SSIServlet </servlet-class> <init-param> <param-name>buffered</param-name> <param-value>1</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <init-param> <param-name>expires</param-name> <param-value>666</param-value> </init-param> <init-param> <param-name>isVirtualWebappRelative</param-name> <param-value>0</param-value> </init-param> <load-on-startup>4</load-on-startup> </servlet> and also you need to map appropriate URLs on to that support: <servlet-mapping> <servlet-name>ssi</servlet-name> <url-pattern>*.shtml</url-pattern> </servlet-mapping> There's one further change to make - the SSI API is provided in a .jar file that you need to rename in the /usr/local/tomcat/server/lib (or similarly named) directory: mv servlets-ssi.renametojar servlets-ssi.jar See also Deploying applications under httpd and Tomcat Please note that articles in this section of our
web site were current and correct to the best of our ability when published,
but by the nature of our business may go out of date quite quickly. The
quoting of a price, contract term or any other information in this area of
our website is NOT an offer to supply now on those terms - please check
back via our main web site
Related Material
Web Application Deployment - Tomcat - Configuring Web Applications Web Application Deployment - Tomcat -Sourcing, Installing and Initial Testing Web and Intranet - Executable Content resource index - Java Solutions centre home page You'll find shorter technical items at The Horse's Mouth and delegate's questions answered at the Opentalk forum. At Well House Consultants, we provide training courses on subjects such as Ruby, Perl, Python, Linux, C, C++, Tcl/Tk, Tomcat, PHP and MySQL. We're asked (and answer) many questions, and answers to those which are of general interest are published in this area of our site. |
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho | |||||||||||