本帖最后由 fanqingpeng2012 于 2013-06-18 22:44:00 编辑

解决方案 »

  1.   

    第三行:users) ServletActionContext.getRequest().getSession()
    改成:(users) ai.getInvocationContext().getSession();
    试试看
      

  2.   

    同意一楼写法。
    把第三、四行改进一下
    String lusername= (String) ServletActionContext.getRequest().getSession()
    .get("lusername");
    注意第四行的写法.getAttribute("lusername");改成.get("lusername");
      

  3.   

    login方法怎么能写在coreAction里呢?目测拦截器栈的配置没问题,警告的问题不清楚
      

  4.   

    就是死循环,要不拦截器对login方法做if判断,要不login方法写到不被拦截器拦截的action
      

  5.   

    你先debug一下,看看过滤器有没有执行呀?
      

  6.   

    登录的逻辑是不能放入到拦截器的。因为你实际要拦截的是其他的方法。
    不然你调用的登录的方法,也会被拦截器拦截的。所以不管你你调用其他的方法,或者登录的方法,都会被拦截的,这就造成了死循环了。建议你的登录的方法写到另一个action(比如 LoginAction),然后在struts.xml配置另一个package
    如:
    <package name="login" extends="struts-default">
    <action name="login" class="Action.LoginAction" method="Login">
    <result name="success" type="dispatcher">/LoginSuccess.jsp</result>
    <result name="LoginFail" type="redirect">/Login.jsp</result>
    </action>
    </package>楼主可以试一试。
      

  7.   

    回复于: 2013-06-18 22:49:44 第三行:users) ServletActionContext.getRequest().getSession()
     改成:(users) ai.getInvocationContext().getSession();
     试试看 
      

  8.   

    是配置文件的问题,我解决了
    <param name="includeMethods">jia,jian,cheng,chu</param>
    <param name="excludeMethods">Login</param>应该写在
    <interceptor-ref name="LoginInterceptor"></interceptor-ref>里面作为子元素