且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

拦截器在Struts 2.0中登录时使用

更新时间:2022-06-26 21:49:51

此代码应该为您提供servlet请求中的参数。假设您有一个参数值。

This code should give you parameters from the servlet request. Assume you have one value for the parameter.

public String intercept(ActionInvocation actionInvocation) throws Exception 
{
    Map<String, String[]> parameters = ServletActionContext.getRequest().getParameterMap();  
    String userId  = parameters.get("bean.userId")[0];
    System.out.println("Got it:"+userId);
    return actionInvocation.invoke();
}