`

jsp引入menu缓存的问题

阅读更多
在项目中想通过jsp include标签引入目录,这样能省下很多时间,当然不管是通过jstl标签还是struts标签都能实现功能,但是在IE下发现一个bug,就是不同用户session来回跳动的问题,归根结底就是缓存的问题,为了解决此问题,一般的实现方法是在引入的页面中新增清除缓存的Meta即可实现.当然这只是针对需要清楚缓存的情况,下面是代码:
<jsp:include page="../../menu.jsp"></jsp:include>

menu.jsp代码如下:
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
    <head>
       
    </head>
    <body>
        <!--此处省去N个字-->
    </body>
</html>

在head标签中引入以下几句即可:
<meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
		<meta http-equiv="expires" content="0">

总的实现是:
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
    <head>
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
		<meta http-equiv="expires" content="0">
	</head>
    <body>
        <!--此处省去N个字-->
    </body>
</html>
0
6
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics