qlqllu 2009-10-23 00:37 采纳率: 0%
浏览 255
已采纳

struts2中,action之间传递参数的问题

我现在需要把一个action(action1)中的变量传递到另外的一个action(action2)中,两个action中都定义了属性
String userId,User user,并且定义了相应的getter,setter方法,在struts.xml中配置如下:


Action2
/
${user}
${userId}
test

/index_notLogin.jsp

执行时,action2成功调用,但是里面的变量(userId,user)全为null。
为什么?

有帖子说,把type换成“chain”,我换了,还是null。
[b]问题补充:[/b]
blareck:
我的两个action中有同名的参数,并且有getter,setter,为什么还是null?

  • 写回答

4条回答 默认 最新

  • 大雄学编程 2009-10-23 09:02
    关注

    result name="toLiginIndex" type="chain" > Action2

    这样就可以了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?