0

I have a basic web application packaged as an EAR deployed on GlassFish. The web module has some html files. The html files have a common footer, an html file, that I would like to extract out and make an include. When I do, and put:

<!--#include virtual="insertthisfile.html" --> 

in an html file, it does not work. Should this work?

1
  • i add this in the html: #include virtual="insertthisfile.html", with html like comment tags, which do not show up on this site. Commented Aug 3, 2009 at 20:36

2 Answers 2

3

This is a technique called Server-Side Includes (SSI). It may not be enabled on your web host. If it is, sometimes they force a .shtml extension to be required for included files, so try renaming your file insertthisfile.shtml.

If that doesn't work, you might be able to enable SSIs in a .htaccess file (assuming your web server is Apache). You can find instructions on how to do this by googling. There's a decent set here.

If that fails, I would contact your web host and see if they have SSIs enabled.

Sign up to request clarification or add additional context in comments.

Comments

0

Should this work? Perhaps, at some special settings, with some experienced programmer, this could be useful. In my case the include statement seems to be ignored.

I could include some text with

(embed src="include.shtml") (/embed) 

Above, I type () instead of angular brackets.

With the "embed", the setting in the header of the page does not apply to the included text; it should be repeated again, and, by default, the result is ugly. It looks strange, as if the designers of the html did not build-in the very basic tool, the include command. For short articles, the include could save an order of magnitude in the size of files.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.