当前位置:网站首页>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);
%>
这是一种服务器实现的客户端页面跳转技术边栏推荐
猜你喜欢
![LRU缓存[线性表 -> 链表 -> hash定位 -> 双向链表]](/img/ad/dd80541514d6fedde8c730218fdf5a.png)
LRU缓存[线性表 -> 链表 -> hash定位 -> 双向链表]

硬盘分区,拓展C盘,不重装系统,不重装D盘软件的全教程。

通过斐波那契数再谈函数递归2.0

Optimization of five data submission methods

Error EPERM operation not permitted, mkdir ‘Dsoftwarenodejsnode_cache_cacach两种解决办法

Use docker to build mysql master-slave

How does the SAP ABAP OData service support the $filter (filter) operation trial version

【CPU设计实战】简单流水线CPU设计

五种数据提交方式的优化

函数的参数
随机推荐
golang八股文整理(持续搬运)
查看Mysql数据库版本
基本语法(二)
ECCV2022:在Transformer上进行递归,不增参数,计算量还少!
ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)
Talk about the message display mechanism on the SAP product UI
AMBA APB学习记录(AMBA 3/4)
0x80070570 The file or directory is damaged and cannot be deleted (how to delete 0x80070091)
Quickly learn database management
TensorRT安装及使用教程「建议收藏」
ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)解决办法
FastAPI 封装一个通用的response
The 2nd activity of the TOGAF10 Standard Reading Club continues wonderfully, and the highlights will be reviewed!
dosbox基础使用[通俗易懂]
SAP 电商云 Spartacus SSR Optimization Engine 几处 timeout 的执行顺序
docker部署完mysql无法连接
SAP 电商云 Spartacus UI 和 Accelerator UI 里的 ASM 模块
建情人节表白网站(超详细过程,包教包会)
TOGAF10标准读书会第2场活动精彩继续,高光时刻回顾!
PyQt5 rapid development and actual combat 10.2 compound interest calculation && 10.3 refresh blog clicks