当前位置:网站首页>JSP中如何借助response对象实现页面跳转呢?
JSP中如何借助response对象实现页面跳转呢?
2022-07-31 12:55:00 【qq_25073223】
转自:
下文笔者将讲述使用response对象对页面跳转的几种方法分享,如下所示:
通过response.sendRedirect方法跳转
<%response.sendRedirect("index.jsp"); %> sendRedirect:是一种客户端跳转方法,当客户端接收到响应后,重新发起向新页面的链接
通过RequestDispatcher.forward方法跳转
RequestDispatcher rd = request.getRequestDispatcher("index.jsp"); rd.forward(request,response); 这是一种服务器端跳转方式,在内部跳转时,会将共享原页面的request和response对象
JSP网页定时跳转
<% response.setHeader("refresh", "3;URL=index.jsp");%> 3秒后跳转页面 这是一种客户端跳转的方法
JSP页面刷新
<jsp:forward page="login.jsp" /> 它是一种服务器端转发方式,由RequestDispatcher实现相应的操作
JSP页面重定向
<% response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); String newLocn = "login.jsp"; response.setHeader("Location",newLocn); %> 这是一种服务器实现的客户端页面跳转技术
边栏推荐
- 0x80070570 The file or directory is damaged and cannot be deleted (how to delete 0x80070091)
- Fully Dynamically Constrained Robot Efficient Time-Optimal Trajectory Planning
- Basic use of dosbox [easy to understand]
- 这款悄然崛起的国产API接口管理工具,你一定要晓得
- 硬盘分区,拓展C盘,不重装系统,不重装D盘软件的全教程。
- Hybrid brain-computer interface system based on steady-state visual evoked potentials and attentional EEG
- NameNode (NN) and SecondaryNameNode (2NN) working mechanism
- 【OpenCV】-边缘检测汇总示例
- ASM外部冗余是否可以替换磁盘
- 【CPU设计实战】简单流水线CPU设计
猜你喜欢
Ali on three sides: MQ message loss, repetition, backlog problem, how to solve?
MATLAB | 我也做了一套绘图配色可视化模板
The 2nd activity of the TOGAF10 Standard Reading Club continues wonderfully, and the highlights will be reviewed!
365-day challenge LeetCode1000 questions - Day 044 Maximum element in the layer and level traversal
分布式监视 Zabbix 和 Prometheus 到底怎么选?千万别用错了!
电脑重要文件很多,如何备份比较安全?
NameNode (NN) 和SecondaryNameNode (2NN)工作机制
Google Chrome(谷歌浏览器)安装使用
[CPU Design Practice] Simple Pipeline CPU Design
AMBA APB学习记录(AMBA 2.0)
随机推荐
认知—运动康复医疗机器人应用设计
vivado里那些看不懂的原语
计算机复试面试问题(计算机面试常见问题)
SAP message TK 248 solved
CentOS7 - yum install mysql
Centos7 install mysql5.7
PyQt5快速开发与实战10.2 复利计算 && 10.3 刷新博客点击量
P5019 [NOIP2018 提高组] 铺设道路
The 2nd activity of the TOGAF10 Standard Reading Club continues wonderfully, and the highlights will be reviewed!
字符函数和字符串函数
双非一本进字节了!!纯干货分享
ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your
Structural controllability of switched linear systems with symmetry constraints
阿里三面:MQ 消息丢失、重复、积压问题,怎么解决?
Comparison of ipv4 and ipv6 (IPV4)
纷享销客罗旭对话元气森林黄晓枫:零售数字化的终点不是创新,而是数据
FIFO深度计算学习记录(汇总)
求一份常见Oracle故障模拟场景
电脑重要文件很多,如何备份比较安全?
系统集成项目管理工程师(软考中级)知识点总结【挣值分析】【关键路径】