`

获取一些全局变量的方法。

 
阅读更多
//获取全局session
Map<String, Object> session = (Map<String, Object>) ActionContext.getContext().getSession();
//从session中拿到登陆用户信息
Admin admin = (Admin) session.get("sessionOperator");

 

 

ServletContext context = ServletActionContext.getServletContext();
//得到某个文件夹在项目的地址路径
String realPath = context.getRealPath("//page/js");
//realPath="D:\FortuneRMS5\02_Source\web\page\js";

 

//读取配置文件的信息
AppConfigurator config = AppConfigurator.getInstance();
//shouldCopyPoster = true;
boolean shouldCopyPoster = config.getBoolConfig("importXml.default.copyPoster", true);

 

//获取全局requst
HttpServletRequest request = ServletActionContext.getRequest();
//获取客户端版本信息
String userAgent = request.getHeader("user-agent");



 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics