Introduction of common headers and bottoms in HTML pages

Source: Internet
Author: User

Reference Links:

Http://www.cnblogs.com/jason-star/p/3345225.html

http://blog.csdn.net/jsxzzliang/article/details/47022055

Use shtml for common header and bottom references

SHTML Introduction:SHTML is a file based on SSI technology, that is, server Side Include--ssi servers containing instructions , some web If the server has SSI function, the shtml file will be specially entertained, the server will first sweep the shtml file to see no special SSI instructions exist, if any, according to the Web server set rules to interpret SSI instructions, after the interpretation of the general HTML with the client.

Advantages of shtml: Use the SSI technology page to generate the sHTML file, only use the header file location to add <!--#include virtual="header.htm"-<!--# Include file= "Header.htm"-->, where the first one represents the path relative to the server, and the second represents the relative path of the file. Then modify the time as long as the Header.htm file can be modified. The advantage of using shtml is that the search engine is friendly and the files that need to be processed are done on the server side without burdening the visitor's browser.

using the steps: Use tomcat as a server example

1. Locate the Tomcat\conf\web.xml file, open the comment <servlet-name>ssi</servlet-name>

Also join <init-param>
<param-name>inputEncoding</param-name>
<param-value>utf-8</param-value>
</init-param>
<init-param>
<param-name>outputEncoding</param-name>
<param-value>utf-8</param-value>
</init-param> modified after effect as follows:<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>inputEncoding</param-name>
<param-value>utf-8</param-value>
</init-param>
<init-param>
<param-name>outputEncoding</param-name>
<param-value>utf-8</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>false</param-value>
</init-param>
<load-on-startup>4</load-on-startup>
</servlet>

2. Open the mapping and modify the. shtml as HTML. The following effects are modified:

<!--the mapping for the SSI servlet--and
<servlet-mapping>
<servlet-name>ssi</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping> 3, modify the Tomcat\conf\context.xml file, modify the effect as follows:<context> change to: <context privileged= "true" 4, restart Tomcat to take effect 5, page nested HTML page 1:index.html<! DOCTYPE html>< html>< head>< Meta charset= "UTF-8">< title> index</title> "UTF-8">< title> index</title>

Introduction of common headers and bottoms in HTML pages

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.