strus2获取客户端ip,ip需根据request对象获取
因需要在拦截器中不知道如何获取ip,故做以下记录:
ActionContext ctx = ActionContext.getContext();
HttpServletRequest req = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
String ip = req.getRemoteAddr();
strus2获取客户端ip,ip需根据request对象获取
因需要在拦截器中不知道如何获取ip,故做以下记录:
ActionContext ctx = ActionContext.getContext();
HttpServletRequest req = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);
String ip = req.getRemoteAddr();