public String intercept(ActionInvocation invocation) throws Exception { ActionContext ctx = invocation.getInvocationContext(); HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST); System.out.println(request.getParameter("url")); System.out.println(request.getRequestURI()); System.out.println(request.getServletPath()); String invocationAction=invocation.getAction().getClass().getName(); String invocationName=invocationAction.substring(invocationAction.lastIndexOf(".")+1,invocationAction.length()); if(invocationName.toLowerCase().endsWith("scope")) { if(invocation.getInvocationContext().getSession().get("user")==null) return BaseAction.USER; } if(invocationName.toLowerCase().endsWith("stage")) { if(invocation.getInvocationContext().getSession().get("operator")==null) return Action.LOGIN; } return invocation.invoke(); }
傳參經過java
public String intercept(ActionInvocation invocation) throws Exception url
便可在頁面中獲得
spa