@SuppressWarnings("unchecked")
public void setToGoingURL( HttpServletRequest request,
HttpSession httpsession,
ActionInvocation invoker) {
String url = ServletActionContext.getRequest().getHeader("referer");
if (url == null || url.equals("")) {
url = "";
String path = ServletActionContext.getRequest().getContextPath();
String actionName = invoker.getProxy().getActionName();
String nameSpace = invoker.getProxy().getNamespace();
if (StringUtils.isNotEmpty(nameSpace)) {
url = url + path + nameSpace;
}
if (StringUtils.isNotEmpty(actionName)) {
url = url + "/" + actionName + "?";
}
Map<String, String[]> zzMap = ServletActionContext.getRequest().getParameterMap();
if (zzMap != null) {
for (String s : zzMap.keySet()) {
String[] value = zzMap.get(s);
for (String val : value) {
url = url + s + "=" + val + "&";
}
}
}
}
httpsession.setAttribute(GOING_TO_URL_KEY, url);
}
在Struts2拦截器里,构造action的URL
最新推荐文章于 2017-10-25 20:12:37 发布