JSP base tag and Meta Tag learning summary _jsp programming

Source: Internet
Author: User

Copy Code code as follows:

<%@ page language= "java" import= "java.util.*" pageencoding= "Utf-8"%>
<!--defines the encoding of the JSP, as well as the introduction of the Java file-->
<%
String path = Request.getcontextpath ();
Get the current project name.
String basepath = request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";
The underlying URL for the current project.
%>

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<!--current http://current host: Port/project Name Base tag defines the absolute path to which the current JSP belongs-->
<base href= "<%=basePath%>" >
<!--define the title of the current JSP page, and the title defined here will be displayed in the page sign of my browser. -->
<title>hello word</title>

The role of the <!--META tags is:

Meta is an auxiliary label for the HTML language Head area. Maybe you think the code is optional. In fact, if you can use a good meta tag,
Will give you an unexpected effect, meta tags have the role of: Search engine Optimization (SEO), the definition of the use of the language page, automatic refresh and refers to
To the new page, the implementation of the Web page conversion dynamic effects, control page buffering, page rating evaluation, control of the window display windows and so on!

Meta tag composition: Meta tags have two properties, which are the Http-equiv property and the Name property, respectively.
Different attribute has different parameter value, these different parameter values realize different Web page function.

1, Name property

The Name property is primarily used to describe the Web page, and the corresponding property value is the content of the content,content mainly
It is convenient for search engine robot to find information and classify information.

The name attribute syntax format for the META tag is:

<meta name= "parameter" content= "specific parameter value" >.

The Name property has the following main parameters:

A, Keywords (keywords)

Description: Keywords is used to tell search engines what the keywords are on your page.

For example: <meta name= "keywords" content= "science,education,culture,politics,ecnomics,relationships,entertaiment, Human ">

B, description (Website content description)

Description: Description used to tell the search engine your site's main content.

For example: <meta name= "description" content= "Thispageisaboutthemeaningofscience,education,culture." >

C, Robots (Robot Guide)

Description: Robots are used to tell search bots which pages need to be indexed and which pages do not need to be indexed.

The parameters of the content are all,none,index,noindex,follow,nofollow. The default is all.

Example: <metaname= "content=" "None" >

D, author (author)

Description: The author of the callout page

Example: <metaname= "author" content= "root,root@xxxx.com" >

2, Http-equiv Property

Http-equiv as the name implies, the equivalent of HTTP file header, it can send back some useful information to the browser to help correct and accurate display of Web page content, and the corresponding property value of the content,content is actually the variable value of each parameter.

The HTTP-EQUIV attribute syntax format for meta tags is:

<meta http-equiv= "argument" content= "parameter variable value" >;

The HTTP-EQUIV attribute has the following main parameters:

A, Expires (term)

Description: Can be used to set the expiration time of a Web page. Once the page expires, it must be retransmitted to the server.

Usage: <meta http-equiv= "Expires" content= "FRI,12JAN200118:18:18GMT" >

Note: The time format for GMT must be used.

B, Pragma (cache mode)

Description: Prevents browsers from accessing page content from the local computer's cache.

Usage: <meta http-equiv= "Pragma" content= "No-cache" >

Note: This setting makes it impossible for visitors to browse offline.

C, refresh (refreshing)

Description: Automatically refreshes and points to the new page.

Usage: <meta http-equiv= "Refresh" content= "2; Url=http://www.jb51.net "> (note the following quotes, in front of the seconds and behind the URL)

Note: 2 of which is to stop for 2 seconds after the automatic refresh to the URL URLs.

D, Set-cookie (Cookie set)

Note: If the page expires, the saved cookie will be deleted.

Usage: <meta http-equiv= "Set-cookie" content= "cookievalue=xxx;expires=friday,12-jan-200118:18:18gmt;path=/" >

Note: The time format for GMT must be used.

E, Window-target (display window settings)

Description: Forces the page to appear as a separate page in the current window.

Usage: <meta http-equiv= "Window-target" content= "_top" >

Note: Used to prevent others from calling their own pages in the frame.

F, Content-type (display set of character set)

Description: Set the character set used by the page.

Usage: <metahttp-equiv= "content-type" content= "text/html;charset=gb2312" >

G, Content-language (Display language Settings)

Usage: <meta http-equiv= "Content-language" content= "ZH-CN"/>

H, Cache-control Specifies the caching mechanism that the request and response follow.
CACHE-CONTROL Specifies the caching mechanism that the request and response follow. Setting Cache-control in a request message or in a response message does not modify
The cache processing process in another message processing process. Cached instructions at request include No-cache, No-store, Max-age, Max-stale, Min-fresh, on

Ly-if-cached, the instructions in the response message include public, private, No-cache,
No-store, No-transform, Must-revalidate, Proxy-revalidate, Max-age.

The instructions in each message have the following meanings
Public indicates that the response can be cached by any buffer
Private indicates that the entire or partial response message for a single user cannot be handled by the shared cache.
This allows the server to simply describe a partial response message from a user that is not valid for another user's request
No-cache indicates that a request or response message cannot be cached
No-store is used to prevent important information from being inadvertently released. Sending in a request message will not use caching for both request and response messages.
Max-age indicates that the client can receive a response that is not longer than the specified time (in seconds)
Min-fresh indicates that the client can receive response times that are less than the current time plus a specified time
Max-stale indicates that the client can receive response messages that exceed the timeout period. If you specify the value of the Max-stale message,
The client can then receive a response message that exceeds the specified value for the timeout period.

-->
<meta http-equiv= "Pragma" content= "No-cache" >
<meta http-equiv= "Cache-control" content= "No-cache" >
<meta http-equiv= "Expires" content= "0" >
<meta http-equiv= "keywords" content= "keyword1,keyword2,keyword3" >
<meta http-equiv= "description" content= "This are my page" >
<!--
<link rel= "stylesheet" type= "Text/css" href= "Styles.css" >
-->


<body>
<!--Add the code I need can be Java,js,jstl,el-->

</body>

Related Article

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.