js文件被浏览器缓存的思考

3/3/2017来源:C/C++教程人气:3217

        <tag>

  <name>version</name>   <tag-class>com.tag.VersionTag</tag-class>   <body-content>empty</body-content>

</tag>

import java.io.IOException; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.TagSupport; public class VersionTag extends TagSupport {     public VersionTag()     {     }     public int doStartTag()         throws JspException     {         try         {             pageContext.getOut().PRint(VERSION);         }         catch(IOException e)         {             throw new JspException("报错", e);         }         return super.doStartTag();     }     private static final long serialVersionUID = -5018322481107988665L;     private static final String VERSION;     static      {         String CURRENT_TIME = String.valueOf(System.currentTimeMillis());         StringBuilder sb = (new StringBuilder("?version=")).append(CURRENT_TIME);         VERSION = sb.toString();     } }