spring bean 文件中增加
<bean class="cn.zno.smse.common.context.VersionServletContext"></bean>
类文件
package cn.zno.smse.common.context; import java.util.Date; import javax.servlet.ServletContext; import org.springframework.web.context.ServletContextAware; public class VersionServletContext implements ServletContextAware { private ServletContext servletContext; @Override public void setServletContext(ServletContext servletContext) { this.servletContext=servletContext; getServletContext().setAttribute("resouceVersion", new Date().getTime()); } public ServletContext getServletContext() { return servletContext; } }
页面中:
<script type="text/javascript" src="js/common.js?v=${resouceVersion}"></script>
所有评论(0)