您的位置:首页 > Web前端 > HTML5

html5离线web应用

2013-11-25 15:58 197 查看
html5离线demo应用在tomcat下部署
1. 修改conf/web.xml .添加一个mime_type

<mime-mapping>  

       <extension>manifest</extension>  

       <mime-type>text/cache-manifest</mime-type>  

 </mime-mapping>

 2.编写test.manifest

CACHE MANIFEST

#文件的开头必须要书写

#这个文件版本号

#version 1.3

CACHE:

jquery-1.10.2.min.js

 

NETWORK:

*

FALLBACK:

index.jsp

说明:缓存文件的意思是只缓存jquery-1.10.2.min.js,index.jsp页面以及index.jsp页面采用的ajaxURL都可以发送请求,不缓存页面中的URL请求。

3.index.jsp

<!DOCTYPE html>

<html manifest="test.manifest">

    <head>

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

     <script type="text/javascript" src="jquery-1.10.2.min.js"></script>

    </head>

    <body>

      <p>jsp离线web应用</p>

    </body>

</html>

4 .文件结构

  webroot

     -test/index.jsp

     -test/test.manifest

     -test/jquery-1.10.2.min.js

环境说明:tomcat下测试html5本地缓存应用一定要用jsp.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息