Struts2的 - 与动态参数标注转发 [英] Struts2 - forward by annotation with dynamic parameter
问题描述
我想作用的结果期待与动态参数另一个动作。传递的参数为第二个动作有,
值。
@Result(NAME =成功,
位置=edit_service_subscribers
键入=重定向
PARAMS = {selectedServiceId,%{服务ID}
)
我宣布私有String服务ID;
在第一个动作getter和setter,
和私有String selectedServiceId;
在第二个行动getter和setter
问题是与填充参数的值。但是在哪里呢?
如何在动作类传递全局变量的值来重定向参数?
-
使用
RedirectAction
重定向到另一个动作。
重定向
结果用来重定向到非操作URL(如
外部URL)。 -
这是不是OGNL:代替
%{}服务ID
使用
$ {}服务ID
I'm trying to forward action result to another action with dynamic parameter. The passed parameter to second action has ""
value.
@Result(name = "success",
location = "edit_service_subscribers",
type = "redirect",
params = {"selectedServiceId", "%{serviceId}"}
)
I declared private String serviceId;
with getter and setter in first action,
and private String selectedServiceId;
with getter and setter in second action.
Problem is with filling the value of parameter. But where?
How can I pass value of global variable in action class to redirected parameter?
use
RedirectAction
to redirect to another Action.Redirect
result is used to redirect to non-action URLs (like external URLs).This is not OGNL: instead of
"%{serviceId}"
use
"${serviceId}"
这篇关于Struts2的 - 与动态参数标注转发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!