使用 REST 插件 (Struts 2) 时如何进行重定向操作

发布于 2024-12-28 05:26:02 字数 87 浏览 6 评论 0原文

考虑到创建、更新或删除元素后的典型情况,您想要对“index”操作(或任何其他操作)执行redirectAction。如果您使用 REST 插件,该如何制作呢?

Considering the typical case when, after creating, updating or deleting an element, you want to do a redirectAction to the "index" action (or whatever other action). ¿How do you make it if you are using the REST Plugin?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眉黛浅 2025-01-04 05:26:02

在您的操作中,您可以执行以下操作:返回“index”,并且在声明您的类之前,您可以使用 Results 注释。例如:

@Results({
    @Result(name="create", location="/home", type="redirect")
}) 

@Results({
    @Result(name="success", type="redirectAction", params = {"actionName" , "orders"})
})

希望有帮助

In your action, you can do: return "index" and before declaring your class, you can use the Results annotation. For example:

@Results({
    @Result(name="create", location="/home", type="redirect")
}) 

or

@Results({
    @Result(name="success", type="redirectAction", params = {"actionName" , "orders"})
})

Hope it helps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文