Web开发相关

 

basePath

String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
<base href="<%=basePath%>">  // <base> 标签为页面上的所有链接规定默认地址或默认目标。

request.getScheme() 返回当前链接使用的协议;

request.getServerName()可以返回当前页面所在的服务器的名字;

request.getServerPort()可以返回当前页面所在的服务器使用的端口;

request.getContextPath()可以返回当前页面所在的应用的名字;

 

meta标签的http-equiv属性

作用:http-equiv属性提供了content属性的信息/值的HTTP头,可用于模拟一个HTTP响应头

1.Expires(期限) 

<meta http-equiv="expires" content="Wed, 20 Jun 2007 22:33:00 GMT">

用于设定网页的到期时间,一旦网页过期,必须到服务器上重新传输,必须使用GMT的时间格式;

2.Pragma(cache模式) 

<meta http-equiv="Pragma" content="no-cache">

用于设定禁止浏览器从本地缓存中调阅页面内容,设定后一旦离开网页就无法从Cache中再调出,访问者将无法脱机浏览;

3.Refresh(刷新) 

<meta http-equiv="Refresh" content="2;URL=http://www.net.cn/">

停留所设秒数后,自动刷新并指向新页面;

4.Set-Cookie(cookie设定) 

<meta http-equiv="Set-Cookie" content="cookievalue=xxx;expires=Wednesday, 20-Jun-2007 22:33:00 GMT; path=/">

5.Window-target(显示窗口的设定)

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

强制页面在当前窗口以独立页面显示

6.content-Type(显示字符集的设定)

<meta http-equiv="content-Type" content="text/html; charset=gb2312">

7.Pics-label(网页等级评定)

<meta http-equiv="Pics-label" contect="">

8.设定进入退出页面效果

<meta http-equiv="Page-Enter"    contect="revealTrans(duration=1.0,transtion=    12)">
<meta http-equiv="Page-Exit"    contect="revealTrans(duration=1.0,transtion=    12)">

 Duration的值为网页动态过渡的持续时间,单位为秒;

 Transition是过渡方式,它的值为0到23,分别对应24种过渡方式;

9.清除缓存

<meta http-equiv="cache-control" content="no-cache">

10.设定网页的到期时间 

<meta http-equiv="expires" content="0"> 

11.关键字,供搜索引擎使用

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">  

12.页面描述

<meta http-equiv="description" content="This is my page">

 

posted on 2016-03-05 15:11  huashunli  阅读(174)  评论(0编辑  收藏  举报

导航