search
HomeJavajavaTutorialJava-servlet-Analysis of examples of forwarding AND paths
Java-servlet-Analysis of examples of forwarding AND pathsOct 20, 2017 am 09:30 AM
Case AnalysisForward

The following editor will bring you an article about java-servlet-forwarding AND path (detailed explanation). The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look.

1. Forward:

a) What is forwarding?

One web component hands over the unfinished task to another web component to continue.

Usually a servlet obtains the data and transfers it to jsp for display.

Note: The web component should be servlet or jsp

b) How to forward?

1. Bind the data to the request object.

request.setatteribute(string name,obj)

Note: name binding name obj: binding value

obj request.getattr…(string name);//Get the binding value based on the binding name.

2. Get Forwarder

requestdispatatcher rd = request.getrequestdispatcher(string url);

Note: forwarding destination, such as a jsp

3. Forwarding

rd.forward(request, response)

Note: The essence of forwarding is that a web component notifies the container to call another web component (that is, calling the service method, so the request needs to be passed , response)

c) Features:

1. The forwarding destination is limited (requires the same web application A certain address)

2. After forwarding, the browser address remains unchanged.

d) Compare redirection and forwarding:

1. Each web component involved in forwarding can share request and response. Redirection cannot.

Note: request and response The survival time is not long (the server will create these two objects immediately after receiving the request, and destroy these two objects immediately when the response is sent). That is, the survival time of these two objects is the period between a request and a response.

2. After forwarding, the address in the browser address bar remains unchanged (requires an address in the same web application), there is no restriction on redirection and the address will change.

3. Path problem:

a) What is a path problem?

Links, form submissions, redirects and forwarding all need to fill in a path, such as

How to fill in this path /

b) Relative path

1. What is a relative path?

Path that does not start with "/".

c) Absolute path

1 .What is a relative path?

Path starting with "/".

2. How to write an absolute path?

Links, form submissions, redirects are written starting from the application name, forwarding is written starting from the application name.

zNote: Do not write the application name directly in the path, you should use request.getcontextpath() gets the application name.

The above is the detailed content of Java-servlet-Analysis of examples of forwarding AND paths. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
微信语音怎么转发 微信的语音信息怎么转发微信语音怎么转发 微信的语音信息怎么转发Feb 22, 2024 pm 05:30 PM

只需要将语音转成笔记再发给别人即可。教程适用型号:iPhone13系统:iOS15.5版本:微信8.0.7解析1首先把语音信息添加到收藏,然后在收藏页面打开语音。2在语音界面点击右上角的三个点。3接着在下方的列表中点击转存为笔记。4最后在笔记界面点击发送给朋友即可。补充:微信语音怎么转文字1首先在微信聊天界面长按要转化的语音。2然后在弹出的窗口中点击转文字。3最后语音就被转换成文字了。总结/注意事项微信语音信息不能直接进行转发,需要先转成笔记的形式。

微信语音怎么转发?微信语音转发的方法微信语音怎么转发?微信语音转发的方法Mar 07, 2024 am 09:00 AM

微信,作为一款功能丰富的社交软件,支持多种通讯方式,包括文字、语音和视频等。其中,语音消息为用户提供了便捷的沟通方式。然而,微信原生并不支持直接转发语音消息。但可以通过其他方法实现,微信语音转发的方法有多种,以下提供两种常见方式:如收藏转发或录屏转发。微信语音怎么转发?微信语音转发的方法第一种方法,收藏转发1、长按需要转发的微信语音消息,直到出现多选菜单。2、勾选需要转发的语音消息,然后点击屏幕下方的【收藏】按钮。3、进入微信【我】的页面,点击【收藏】选项,找到刚才收藏的语音消息。4、点击语音消

微博怎么快转_微博快转教程微博怎么快转_微博快转教程Mar 30, 2024 pm 03:51 PM

1、首先进入手机微博,点击推荐选项。2、然后选择微博,点击分享图标。3、接着点击快转选项。4、最后可查看微博快转发送成功。

微信如何转发文章?微信转发文章的方法微信如何转发文章?微信转发文章的方法Mar 04, 2024 am 10:04 AM

微信是我们常用的媒体社交软件。很多个人或者博主喜欢在朋友圈分享记录自己的生活。当我们看到一些好的文章,网红的博客,诱人的菜谱时,往往想要转发到自己的朋友圈,分享给亲朋好友,顺便在自己方便的时候再次查看。以免再想看的时候找不到。那么我们来学习一下微信如何转发文章吧!微信如何转发文章?微信转发文章的方法1、如果是朋友圈的链接,可以直接分享到自己的朋友圈,如果是别人发的文章,只能长按复制,然后长按右上角相机图标三秒,粘贴文字,然后发布,如果要转发别人图片,必须先将图片保存到自己手机上,然后选择上传。2

视频号如何转发到自己的视频号?咋监测及分析转发效果?视频号如何转发到自己的视频号?咋监测及分析转发效果?Mar 27, 2024 pm 03:41 PM

在视频创作和分享盛行的今天,视频号已成为许多人展示才能和观点的首选平台。本文将详细探讨如何将他人的精彩视频转发到自己的视频号上,以便更好地分享和推广优质内容。一、了解视频号平台的特点和功能在考虑将他人的视频转发到自己的视频号之前,必须先熟悉视频号平台的特点和功能。视频号是一个以视频为核心的内容分享平台,用户可以在其中发布、创作和分享各种视频内容。重要的一些方面包括:转发功能:视频号平台通常都提供了转发功能,允许用户将他人的视频分享到自己的视频号上。源视频标识:转发时,原始视频的信息通常会保留,包

从零开始搭建Discuz论坛:详细教程与实例分析从零开始搭建Discuz论坛:详细教程与实例分析Mar 15, 2024 am 08:09 AM

从零开始搭建Discuz论坛:详细教程与实例分析随着互联网的发展,论坛作为一个重要的社交交流平台,在网络中占据着重要地位。而Discuz作为目前国内最受欢迎的论坛系统之一,具有稳定性高、易于定制和丰富的插件等特点,深受用户喜爱。在本文中,我们将介绍如何从零开始搭建一个Discuz论坛,包括详细的教程步骤和实例分析,同时会提供具体的代码示例。第一步:服务器环境

php-fpm进程管理技巧与实例分析php-fpm进程管理技巧与实例分析Jul 08, 2023 am 08:03 AM

PHP-FPM进程管理技巧与实例分析概述:在PHP网页开发中,PHP-FPM(FastCGIProcessManager)是一种进程管理器,负责处理来自Web服务器的请求。它采用基于事件的模型来管理PHP进程,提供了更高效的请求处理能力。本文将介绍一些PHP-FPM的进程管理技巧,并结合实例进行分析。一、进程池调整技巧:1.1调整进程数量:根据服务器的

端口转发工具Rinetd详细入门教程端口转发工具Rinetd详细入门教程Feb 19, 2024 pm 12:00 PM

Rinetd是一款用于端口转发的实用工具,它能够将流量从一个端口重定向到另一个指定的端口。以下是Rinetd的简明入门教程:安装Rinetd:打开终端窗口,运行以下命令安装Rinetd:sudoaptupdatesudoaptinstall-yrinetd配置Rinetd:Rinetd的配置文件位于/etc/rinetd.conf。使用你喜欢的文本编辑器打开该文件:sudonano/etc/rinetd.conf在配置文件中添加端口转发规则:每一行表示一个端口转发规则,格式为源IP源端口目标IP

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function