既然客户端浏览器每次请求服务器,服务器都会返回一些资源给浏览器,如果这些资源永远不变,即您通过浏览器每次发送请求后,服务器返回给浏览器的资源都是不变的,那么服务器完全不需要做任何操作。但很多时候,您想要服务器返回的资源是需要变动的,比如您想看今天的天气预报,这时候资源如果是不变的,那您看每天的天气都是固定的了,这显然是不对的。那怎样才能让每天的天气都是变化的呢?
我们先看一个例子吧:下面是一个静态页面。
<html>
<head>
<title>天气</title>
</head>
<body>
<div class="page-header">
<h1><font color="#0099cc">2015年01月01日-天气情况</font></h1>
<h1><small><span style="color:#FF0000;">晴转多云</span></small></h1>
</div>
</body>
</html>
时间随时在变,天气也是天天在变的。如果我们需要看每天的天气,难道这个页面需要天天修改吗?答案肯定是否定的,变动的只是时间和天气情况,我们可不可以把这两个点空出来呢?
<html>
<head>
<title>天气</title>
</head>
<body>
<div class="page-header">
<h1><font color="#0099cc">____-天气情况</font></h1>
<h1><small><span style="color:#FF0000;">____</span></small></h1>
</div>
</body>
</html>
%26%23x50CF%3B%26%23x4E0A%3B%26%23x9762%3B%26%23x8FD9%3B%26%23x6837%3B%26%23xFF1A%3B%26%23x628A%3B%26%23x9700%3B%26%23x8981%3B%26%23x53D8%3B%26%23x52A8%3B%26%23x7684%3B%26%23x5730%3B%26%23x65B9%3B%26%23x6362%3B%26%23x6210%3B%26%23x6211%3B%26%23x4EEC%3B%26%23x9700%3B%26%23x8981%3B%26%23x586B%3B%26%23x5199%3B%26%23x7684%3B%26%23x90E8%3B%26%23x5206%3B%26%23xFF0C%3B%26%23x8FD9%3B%26%23x4E2A%3B%26%23x8FC7%3B%26%23x7A0B%3B%26%23x79F0%3B%26%23x4E4B%3B%26%23x4E3A%3B%26%23x6A21%3B%26%23x677F%3B%26%23x5316%3B%26%23x3002%3B%26%23x4E0A%3B%26%23x9762%3B%26%23x8FD9%3B%26%23x4E2A%3B%26%23x5C31%3B%26%23x662F%3B%26%23x4E00%3B%26%23x4E2A%3B%26%23x6A21%3B%26%23x677F%3B%26%23xFF0C%3B%26%23x8FD9%3B%26%23x5C31%3B%26%23x76F8%3B%26%23x5F53%3B%26%23x4E8E%3B%26%23x6211%3B%26%23x4EEC%3B%26%23x5728%3B%26%23x505A%3B%26%23x586B%3B%26%23x7A7A%3B%26%23x9898%3B%26%23x4E00%3B%26%23x6837%3B%26%23xFF0C%3B%26%23x53EA%3B%26%23x8981%3B%26%23x628A%3B%26%23x60F3%3B%26%23x8981%3B%26%23x7684%3B%26%23x6570%3B%26%23x636E%3B%26%23x586B%3B%26%23x8FDB%3B%26%23x53BB%3B%26%23xFF0C%3B%26%23x6211%3B%26%23x4EEC%3B%26%23x7684%3B%26%23x4EFB%3B%26%23x52A1%3B%26%23x5C31%3B%26%23x5DF2%3B%26%23x7ECF%3B%26%23x5B8C%3B%26%23x6210%3B%26%23x4E86%3B%26%23x3002%3B
其实十分简单,正如上文描述规则时所知道的方法,如果我们知道了至少两个实际的页面例子,通过对比,就可以知道哪些地方变化了,这些变化的地方就是需要标注为填空的地方。我们把在普通文档中标记需要填空的过程,称为标注。
因为模板中的空可不止一个,我们马上会面临一个问题,如何描述哪个值填到哪个空里呢?您可以回想下以前填过的表格,我们通过给一个名称,例如我们会说:“姓名栏,年龄栏......”。类似的,我们会为每个需要填充的空命名。WIDE支持两种标注方法,分别是自由标注以及绑定标注,都会使用一个变量名来指示空格所处位置。如果使用自由标注,会是%7B%7B%3Dit.shijian%7D%7D、%7B%7B%3Dit.tianqixiangqing%7D%7D这样的形式。如果使用绑定标注,会是shijian,tianqixiangqing这样的形式。