当前位置:网站首页>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);
%>
这是一种服务器实现的客户端页面跳转技术边栏推荐
- Two methods of NameNode failure handling
- 纷享销客罗旭对话元气森林黄晓枫:零售数字化的终点不是创新,而是数据
- [CPU Design Practice] Simple Pipeline CPU Design
- NameNode故障处理的两种方法
- PyQt5 rapid development and actual combat 10.2 compound interest calculation && 10.3 refresh blog clicks
- 认知—运动康复医疗机器人应用设计
- Structural controllability of switched linear systems with symmetry constraints
- 全动力学约束的机器人高效时间最优轨迹规划
- Exploring Plain Vision Transformer Backbones for Object Detection 论文阅读笔记
- /run/NetworkManager占用空间过大
猜你喜欢

【OpenCV】-边缘检测汇总示例

CentOS7 installation MySQL graphic detailed tutorial

NameNode (NN) 和SecondaryNameNode (2NN)工作机制

手撕Verilog PWM呼吸灯

AMBA APB学习记录(AMBA 2.0)

Exploring Plain Vision Transformer Backbones for Object Detection 论文阅读笔记

阿里三面:MQ 消息丢失、重复、积压问题,怎么解决?

alert(1) (haozi.me)靶场练习

Architecture Camp | Module 8

ERROR 1819 (HY000) Your password does not satisfy the current policy requirements
随机推荐
系统集成项目管理工程师(软考中级)知识点总结【挣值分析】【关键路径】
使用openssl命令生成证书和对应的私钥,私钥签名,公钥验签
PyQt5 rapid development and actual combat 10.2 compound interest calculation && 10.3 refresh blog clicks
Ali on three sides: MQ message loss, repetition, backlog problem, how to solve?
Flutter键盘可见性
聊聊 SAP 产品 UI 上的消息显示机制
双非一本进字节了!!纯干货分享
NameNode (NN) and SecondaryNameNode (2NN) working mechanism
Centos7 install mysql5.7
Exploring Plain Vision Transformer Backbones for Object Detection Paper Reading Notes
jmeter性能测试步骤入门(性能测试工具jmeter)
立一个flag
PyQt5快速开发与实战 9.7 UI层的自动化测试
0X7FFFFFFF,0X80000000「建议收藏」
基于verilog的CRC校验(汇总)
知名无人驾驶公司:文远知行内推
FastAPI encapsulates a generic response
CWE4.8 -- 2022年危害最大的25种软件安全问题
深圳某游戏研发公司每个工位都装监控,网友:堪比“坐牢”!
SAP message TK 248 solved