我想知道如何使用 Struts2 通配符功能根据返回值将用户重定向到另一个操作:
struts.xml
:
<action name="menu" class="a.b.c.d.e.f.actions.SecureMenuAction" method="prompt" >
<result name="success" type="tiles">.clf.sm</result>
<result name="input" type="tiles">.clf.smLevel3</result>
<result name="*" type="redirectAction">{1}</result>
</action>
行动:
String redirectString;
// --- code --- \\
return redirectString;
在某些情况下,返回结果SUCCESS
orINPUT
是有效的,但在所有其他情况下,我希望将返回的确切字符串用作重定向位置。
如果我将我的替换struts.xml
为:
<result name="test*" type="redirectAction">{1}</result>
然后{1}
将替换为test
,然后是我希望用户定向到的正确操作。
但是,如果我只是简单地*
用作我的结果名称,那么它根本不会替换{1}
(好像不能像这样使用通配符功能)。
有谁知道我可以使用 Struts2 (2.3.16.2) 中提供的功能来实现它吗?