result有一个type属性,这里的type默认是dispatcher,但这种情况下action之间是不能发送请求的,这时我们就要用到redirect、redirect-action、chain,当要请求一个action时,可设定type的值为以上三个中的一个
如:
<result name="reload" type="redirectAction" >/manager/managerInfo/account.action</result>.
如果想在请求的过程中添加参数可以像超链接传值一样在最后用"xx?xx=xx"的形式来传递参数.
如:
<result name="reload" type="redirectAction">/manager/ managerInfo/account.action?参数名=参数值</result>
,如果这里的参数值不是一个固定值可以用"${参数值}"这种形式,需要注意的是这里的"参数值"在相应的Action中一定要提供get/set方法,否则将无法获得参数值,当然这里也同样可以取一个对象的某个属性值即:${对象名.属性名},
假如我想取得一个帐户的帐号:
<result name="reload" type="redirectAction" >/manager/managerInfo/account.action?account.accountNO=${account.accountNO}</result>.
如果想传递多个参数用"&"符号来连接吗?NO,因为用"&"会在XML语法检查中报错,所以将"&"用"&"来替换就行了!
如:
<result name="reload" type="redirectAction" >/manager/managerInfo/account.action?account.accountNO=${account.accountNO}&account.balance=${account.balance}</result>.