“mapping.getInputForward()”是什么时候?用过的?
我想知道 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
getInputForward()
正如它所说的那样:它返回一个与操作的input
属性值相对应的ActionForward
。您可能不想将其用作一般的“返回上一页”,因为这没有任何意义。它通常在“手动”调用验证并且出现验证错误时使用;
input
值将是表单页面。在这些情况下,它类似于“返回上一页”,但有所不同,因为它通常是到表单 JSP 的转发(而不是重定向)。也就是说,它只是一个普通的
findForward
,但用于操作的input
页面。getInputForward()
does precisely what it says it does: it returns anActionForward
corresponding to the action'sinput
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'sinput
page.