当前位置:网站首页>forward与redirect的区别
forward与redirect的区别
2022-07-30 03:50:00 【虎起来】
forward和redirect是什么?
是servlet种的两种主要的跳转方式。forward又叫转发,redirect叫做重定向。
两者的区别总结:
1. 从地址栏显示来说:
1)forword是服务器内部的重定向,服务器直接访问目标地址的 url网址,把里面的东西读取出来,但是客户端并不知道,因此用forward的话,客户端浏览器的网址是不会发生变化的。
2)redirect是服务器根据逻辑,发送一个状态码,告诉浏览器重新去请求那个地址,所以地址栏显示的是新的地址。
2. 从数据共享来说:
1)由于在整个定向的过程中用的是同一个request,因此forward会将request的信息带到被重定向的jsp或者servlet中使用。即可以共享数据
2)redirect不能共享
3. 从运用的地方来说
1)forword 一般用于用户登录的时候,根据角色转发到相应的模块
2) redirect一般用于用户注销登录时返回主页面或者跳转到其他网站
4. 从效率来说:
1)forword效率高,而redirect效率低
5. 从本质来说:
forword转发是服务器上的行为,而redirect重定向是客户端的行为
forward是内存服务器处理完,客户端无感知的访问到指定界面,forward如下图:
redirect是通过重定向发送给客户端重定向地址,等待客户端重新访问到新的地址,客户端是知晓本次重定向的,redirect如下图:
边栏推荐
- Summary of Rpc and gRpc Introduction
- Flutter records and learns different animations (1)
- 淘宝/天猫获取卖出的商品订单列表 API
- Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (4) Opening Report
- 监控页面部署
- Sentinel Traffic Guard
- spicy (1) basic definition
- Taobao/Tmall get the list of sold product orders API
- SQLSERVER将子查询数据合并拼接成一个字段
- sqlmap使用教程大全命令大全(图文)
猜你喜欢
发给你的好友,让 TA 请你吃炸鸡!

【Node访问MongoDB数据库】

(redistribute, special comprehensive experiment ospf area)

SDL播放器实战

How to solve the error "no such file or directory" when EasyCVR starts?

小程序毕设作品之微信二手交易小程序毕业设计成品(8)毕业设计论文模板

Forum management system

The difference between BGP room and ordinary room in Beijing

Public chains challenging the "Impossible Triangle"

OA Project Pending Meeting & History Meeting & All Meetings
随机推荐
Starlight does not ask passers-by!The young lady on the Wuhan campus successfully switched to software testing in three months and received a salary of 9k+13!
SQLSERVER将子查询数据合并拼接成一个字段
TCP congestion control technology and acceleration principle of BBR
AI智能安防视频平台EasyCVR如何配置音视频同时传输?
SQL 入门之第一讲——MySQL 8.0.29安装教程(windows 64位)
[ 云原生之谜 ] 云原生背景 && 定义 && 相关技术详解?
Microservice CAP Principles
What is the difference between mission, vision and values?
Uptime Monitoring: How to Ensure Network Device Uptime
小程序毕设作品之微信积分商城小程序毕业设计成品(5)任务书
Flutter record learning different animation (2)
Process priority nice
day10--在Linux上安装mysql
一起来学习flutter 的布局组件
cv2.polylines
2022-07-29 Group 4 Self-cultivation class study notes (every day)
Introduction to management for technical people 1: What is management
Gateway routing gateway
Nacos集群分区
MySQ deadlock