jsp中取得服务器时间并动态显示
<%
Calendar rightNow = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String sysdate = format.format(rightNow.getTime());
int week = rightNow.get(rightNow.DAY_OF_WEEK);
String weekary[] ={"月曜日","火曜日","水曜日","木曜日","金曜日","土曜日","日曜日"};
%>
<script language="javascript">
//从服务器上获取初始时间
var currentDate = new Date(<%=new java.util.Date().getTime()%>);
function run()
{
currentDate.setSeconds(currentDate.getSeconds()+1);
document.getElementById("dt").innerHTML =
currentDate.toLocaleString();
}
window.setInterval("run();", 1000);
</script>
<div id="dt">自动显示时间。。。。</div>
相关文档:
转自:http://blog.sina.com.cn/s/blog_5990faac0100dnfx.html
Cookie
:服务器在一个应答首部传递给浏览器的名称
/
值对。浏览器保存的时间由
cookie
的过期时间属性来指定。当浏览器向某个服务器
发送一个请求时,它会检查其保存的
cookie
,并在请求首部中包含从同一台服务器上接收到的所有
cookie
。
Se ......
<c:if>用于
流程控制
语法
1:
<c:if
test=”testCondition” var=”varName”
[scope=”page|request|session|application”]/>
语法
2:
<c:if
test=”testCondition” var=”varName”
[scope=&rdquo ......
一、概述
缓存的思想可以应用在软件分层的各个层面。它是一种内部机制,对外界而言,是不可感知的。
数据库本身有缓存,持久层也可以缓存。(比如:hibernate,还分1级和2级缓存)
业务层也可以有缓存(但一般来说,这是一个过程域,不会设缓存)。
&nbs ......
tomcat 默认使用的字符集是ISO-8859-1,不支持中文字符,所以在现实中文时需要转换字符和设置字符集。
server.mxl改为<Connector port="8080" protocol="HTTP/1.1" maxThreads="150" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" /> ,添加代码转换字符String.getBytes("ISO-8859-1"),"UTF-8 ......