一丶实现页面图片通过后台进行动态修改
(1)后台传递图片路径与随机数
//读取最新首页图片
List<Attach> attachs = Md.selectList("attach.getloginimg", null,
Attach.class);
//避免网页调用缓存数据
String random=new Date().getTime()%100000+""+new Random().nextInt(100000);
mm.put("random",random);
mm.put("attachs",attachs);
(2)页面获取并展示图片
<img src="${ctxPath}${attachs[0].url}?random=${random}">
二丶对于项目框架涉及Apache Shiro时,要注意shiro是否放开对于图片路径的限制
<property name="filterChainDefinitions">
<value>
/upload/**=anon
</value>
</property>