重定向或转发 [英] Redirect or forward

查看:54
本文介绍了重定向或转发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 struts one 查看我面前的一些遗留代码,我明白了:

Looking through some legacy code I have in front of me using struts one, I see:

<global-forwards>
     ...
     <forward name="accessDenied" path="/www/jsp/AccessDeniedForm.do" redirect="true" />
</global-forwards>

所以它只是一个全局转发发送到访问被拒绝的页面.我很好奇重定向而不是转发的决定.使用它有什么优点和缺点?

So it's just a global forward to send to a access denied page. I am curious about the decision to redirect as opposed to forward. What are the advantages and disadvantages of using it?

推荐答案

使用它的优点和缺点是什么?

What are the pro's and con's of using it?

在讨论使用重定向设置为 true 的 forward 元素的利弊之前,让我们了解该配置的实际情况.当转发元素中的重定向设置为 true 时,应该向用户代理发出重定向指令,以便为此转发的资源发出新请求.此链接可能会提供您需要的详细信息.

Before discussing pro's and con's of using that forward element with redirect set to true, let's understand what is actually going on with that configuration. When redirect is set to true in the forward element, a redirect instruction should be issued to the user-agent so that a new request is issued for this forward's resource. This link will probably provide detail information that you need.

redirect 的默认值是 false,本质上当 forward 元素被调用时,它转发到指定的路径,就是这样.例如,如果您将重定向设置为 true,则浏览器将发出另一个请求.所以我认为通过这些说,如果你真的想使用它,你可能知道或知道它的利弊.

The default value for redirect is to false, essentially when the forward element is called, it forward to that path specified and that's it. If you are setting redirect to true, take for example, the browser will make another request. So I think with these said, you probably know or have an idea the pro and con if you really want to use it.

这篇关于重定向或转发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆