Struts2使用Interceptor做用户登陆检查: 1)新增一个bean: User.java package com.my.beans; import java.util.Date; import org.apache.struts2.json.annotations.JSON; public class User { private int userId; private String username; private String password; private int age…
//struts2 源码 public static final Random RANDOM= new Random(); public static String generateGUID(){ return new BigInteger(165,RANDOM).toString(36).toUpperCase(); } 另(其他):设计成单例模式,降低随机数出现的重复的概率 public String generateToken(){ String token = System.curent…