<interceptors>
 <interceptor name="authority" class="com.app.invo.LoginInterceptor" />
     <interceptor-stack name="mydefault">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="authority" />
</interceptor-stack>
 </interceptors>
<default-interceptor-ref name="mydefault" />
这是XML里面的配置,
public String intercept(ActionInvocation invocation) throws Exception {
ActionContext ctx = invocation.getInvocationContext();
Map session = ctx.getSession();
Object user = session.get("uname");
System.out.println("enter");
if (null != user) {
System.out.println("enter1");
return invocation.invoke();
}
System.out.println("enter2");
return Action.INPUT;
}
这是authority拦截器里面的代码,只是看session里是否有记录判断用户是否登陆,在IE7下面没有问题,但是IE6下面,用户登陆后拦截器取uname的时候一直
为空,怎么这样啊IE7下面都没问题的啊,为什么6就出问题了呢?谁能帮帮忙啊,都晕死了

解决方案 »

  1.   

    protected Map<String,String> getSession() {
            return ActionContext.getContext().getSession();//from ActionContext here!
    }
      

  2.   


    Here are the relevant lines of code from the interceptor.ActionContext actionContext = invocation.getInvocationContext();
    HttpServletRequest request = (HttpServletRequest)
     actionContext.get(StrutsStatics.HTTP_REQUEST);
    HttpSession session = request.getSession(false);
    if (session != null)
    {
     ...
     Collection actionMessages = validationAware.getActionMessages();
     if (actionMessages != null && actionMessages.size() > 0)
     {
       session.setAttribute(ACTION_MESSAGES_KEY, actionMessages);
     }
     ...
    }
      

  3.   

    今天我在测试了下,在别的装IE6的机器上,发现没有问题。是不是因为我的IE6是绿色版的问题啊。自己机器IE7 没问题,别的机器IE6也么问题。。谢谢大家的回复,5楼的那些,俺回去在试试看