jsp客户端去缓存和服务端去缓存
网页缓存的作用是什么?应该很重要。但是我们在开发网络应用的时候,网页缓存总是给我们一种莫名的烦恼。于是几乎每一个开发者都试图解决过这个问题。当然,我也不是今天才着手解决这个问题。但是今天一时心血来潮,写一篇,记录一下用到的方法。
1.禁止客户端缓存要在<head>中加入类似如下内容(我当然还没有这么用过):
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
2.在服务器的动态网页中禁止缓存,要加入类似如下脚本
(1)asp(好久不用了):
<%
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.cachecontrol = "no-cache"
%>
(2)jsp(我现在经常用的):
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
相关文档:
<%@ page contentType="text/html;charset=GBK"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*" %>
<%
//在这里如果写成“WEB-INF\templates\template.htm”程序会报错
String filePath = request.getRealPath("/")+"WEB-INF/templates/template.htm"; &nbs ......
一、jsp连接Oracle8/8i/9i数据库(用thin模式)
testoracle.jsp如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Stri ......
1 Javascript ,设置一个变量,只允许提交一次。
#lt;script language="javascript"#gt;
var checkSubmitFlg = false;
function checkSubmit() {
if (checkSubmitFlg == true) {
return false;
}
checkSubmitFlg = true;
return true;
}
document.ondblcli ......
一、
问:org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "192.168.254.103", user "postgres",database "postgres", SSL off
答:PostgreSQ数据库为了安全,它不会监听除本地以外的所有连接请求,当用户通过JDBC访问是,就会报一些以上的异常。要解决这个问题 ......