cookie缓存菜单选项

js 操作cookie

 
1、先去百度找到jquery.cookie.js并引用进来
2、添加样式 .current{background:url(../images/M_li5.gif) no-repeat;}
3、添加代码
<script type="text/javascript">
$(function(){
    $("#Mu1 li ul li a").click(function(){
        $.cookie("navstation", $(this).html(), { path: "/" });
    });
});
</script>
 
4、在导航html代码的下面添加
<script type="text/javascript">
var navstation = $.cookie("navstation");
if(navstation != null){
    $("#Mu1 li ul li a").each(function(){
        if($(this).html() == navstation){
            $(this).parent().parent().css("display","block");
            $(this).addClass("current");
        }
    });
}
</script>

 
 
 
 
 
 
 
 
 
springmvc 定时器

@Configuration
@EnableScheduling
public class ScheduledTasks {
 
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
@Scheduled(fixedRate = 5000)
public void reportCurrentTime() {
//System.out.println("The time is now " + dateFormat.format(new Date()));
}
}
 
 

 
 
springmnv aop日志
 
 
@Aspect
@Component
public class SystemControllerLogger {
 
//本地异常日志记录对象
private static final Logger logger = LoggerFactory.getLogger(SystemControllerLogger.class);
 
//Controller层切点
@Pointcut("execution(* com.sr.p2p.controller.*.*(..))")
public void controllerAspect() {}
 
//@Before("controllerAspect()")
public void doBefore(JoinPoint joinPoint) {}
 
//@After("controllerAspect()")
public void doAfter(JoinPoint joinPoint) {}
 
//@AfterThrowing(pointcut = "controllerAspect()", throwing = "e")
public void doAfterThrowing(JoinPoint joinPoint, Throwable e) {}
 
//@AfterReturning("controllerAspect()")
public void readAfterReturning(){}
 
@Around("controllerAspect()")
public Object readAround(ProceedingJoinPoint joinPoint) {
Date start = new Date();
Object result = null;
try {
result = joinPoint.proceed(joinPoint.getArgs());
} catch (Throwable e) {
e.printStackTrace();
}finally{
Date end = new Date();
String params = "";
if (joinPoint.getArgs() != null && joinPoint.getArgs().length > 0) {
for ( int i = 0; i < joinPoint.getArgs().length; i++) {
params += JSON.toJSON(joinPoint.getArgs()[i]) + ";";
}
}
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String ip = request.getRemoteAddr();
logger.info("startTime:" + start.getTime());
logger.info("method:" + (joinPoint.getTarget().getClass().getName() + "." + joinPoint.getSignature().getName() + "()"));
logger.info("params:" + params);
logger.info("iP:" + ip);
logger.info("endTime:" + end.getTime());
logger.info("costTime:" +(end.getTime()-start.getTime())+" ms");
}
return result;
};
 
}
 

 
权限验证
 

 
 
 
 

posted @ 2019-04-20 16:46  _dafeng  阅读(211)  评论(0编辑  收藏  举报