“mapping.getInputForward()”是什么时候?用过的?

发布于 2025-01-08 06:34:40 字数 186 浏览 4 评论 0原文

我想知道 mapping.getInputForward() 在 Struts 中做什么。 API 表示它创建并返回一个与 Action 的输入相对应的 ActionForward

但我不明白这是什么意思。有人能给我解释得更清楚吗?我可以用这个方法返回上一页吗?如果可以的话,我该怎么做?

I would like to know what mapping.getInputForward() does in Struts. The API says that it creates and returns an ActionForward that corresponds to the input of the Action.

But I don't understand what this means. Could anybody explain to me more clearly? Can I use this method to return to the previous page? And if I can, how do I do this?

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

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

发布评论

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

评论(1

放飞的风筝 2025-01-15 06:34:40

getInputForward() 正如它所说的那样:它返回一个与操作的 input 属性值相对应的 ActionForward

您可能不想将其用作一般的“返回上一页”,因为这没有任何意义。它通常在“手动”调用验证并且出现验证错误时使用; input 值将是表单页面。在这些情况下,它类似于“返回上一页”,但有所不同,因为它通常是到表单 JSP 的转发(而不是重定向)。

也就是说,它只是一个普通的 findForward,但用于操作的 input 页面。

getInputForward() does precisely what it says it does: it returns an ActionForward corresponding to the action's input attribute value.

You probably wouldn't want to use it as a general "return to previous page", because that wouldn't make any sense. It's commonly used when calling validation "by hand" and there's a validation error; the input value would be the form page. In those cases it's similar to "return to previous page", but different, because it's generally a forward (not a redirect) to the form JSP.

That said, it's just a normal findForward but for the action's input page.

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