我用chain跳转就报错,而我有redirectAction跳转就能正常跳过去,找半天都没看到哪里有问题
用chain就报找不到方法的错

解决方案 »

  1.   

    chain在action跳转的时候是共享ActionContext的。目测你转向的action使用了上一个action中的某些属性吧
      

  2.   

    chain 跳转页面提交的参数也跟着一起提交到下个action 
    也就是条船的action中没有接受变量的get  和set 方法
      

  3.   


    说错了没有接受变量的set 方法
      

  4.   


    我就这样设置的啊,但就是转不过来,用redirectAction就可以跳过来
    用chain跳就报错
      

  5.   

    从楼主的异常和struts2的配置文件你的错误应该是在
    <result name="newsListToIndex_success" type="chain">Looks_listToIndex.action</result>
    这个.action struts2认为listToIndex.action这个都是LooksAction里面的方法名,我如果没猜错楼主应该是cn.tt.action.LooksAction有个name="Looks_*" method="{1}"的action配置。struts2把listToIndex.action包含.action都认为是Looks_后面的整体了也就是method变成了listToIndex.action所以才报出这个找不到方法的异常。为了不让struts2把.action也认为是方法那可以在<result name="newsListToIndex_success" type="chain">Looks_listToIndex.action</result>这样改
    <result name="newsListToIndex_success" type="chain">
    <param name="actionName">Looks_listToIndex</param>利用ChainResult的actionName来识别action就不用加.action的后缀了
    </result>
      

  6.   

    不好意思,今天上午没看回复,刚刚我试了一下你说的这样子,不报错了,但是它还是不进去listToIndex方法,用redirectAction就可以进去,我把.action后缀都去了
      

  7.   

    刚刚我代码写错了一个地方,可以了,真的是.action后缀的问题,用chain就跳不过去,是这个原因,太谢谢拉