Home Java javaTutorial Java-servlet-Analysis of examples of forwarding AND paths

Java-servlet-Analysis of examples of forwarding AND paths

Oct 20, 2017 am 09:30 AM
Case Analysis Forward

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 of this Website
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

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to forward WeChat voice messages How to forward WeChat voice messages How to forward WeChat voice messages How to forward WeChat voice messages Feb 22, 2024 pm 05:30 PM

Just convert your voice into notes and send them to others. Tutorial Applicable Model: iPhone13 System: iOS15.5 Version: WeChat 8.0.7 Analysis 1 First add the voice message to the collection, and then open the voice on the collection page. 2 Click the three dots in the upper right corner of the voice interface. 3 Then click Save as Notes in the list below. 4Finally, click Send to Friends on the note interface. Supplement: How to convert WeChat voice to text 1. First, long press the voice you want to convert on the WeChat chat interface. 2 Then click Convert to text in the pop-up window. 3Finally, the voice is converted into text. Summary/Notes WeChat voice messages cannot be forwarded directly and need to be converted into notes first.

How to forward WeChat voice? How to forward WeChat voice How to forward WeChat voice? How to forward WeChat voice Mar 07, 2024 am 09:00 AM

WeChat, as a feature-rich social software, supports a variety of communication methods, including text, voice and video. Among them, voice messages provide users with a convenient way to communicate. However, WeChat does not natively support forwarding voice messages directly. But it can be achieved through other methods. There are many ways to forward WeChat voice. The following two common methods are provided: such as favorite forwarding or screen recording forwarding. How to forward WeChat voice? Method of forwarding WeChat voice The first method is to forward as a favorite. 1. Press and hold the WeChat voice message that needs to be forwarded until a multi-select menu appears. 2. Check the voice messages that need to be forwarded, and then click the [Collect] button at the bottom of the screen. 3. Enter the WeChat [Me] page, click the [Collect] option, and find the voice message you just collected. 4. Click Voice Cancel

How to fast forward on Weibo_Tutorial on fast forwarding on Weibo How to fast forward on Weibo_Tutorial on fast forwarding on Weibo Mar 30, 2024 pm 03:51 PM

1. First, enter Weibo on your mobile phone and click on the recommendation option. 2. Then select Weibo and click the share icon. 3. Then click on the fast forward option. 4. Finally, you can check that Weibo fast forwarding was sent successfully.

How to forward articles on WeChat? How to forward articles on WeChat How to forward articles on WeChat? How to forward articles on WeChat Mar 04, 2024 am 10:04 AM

WeChat is our commonly used media social software. Many individuals or bloggers like to share and record their lives in their circle of friends. When we see some good articles, Internet celebrity blogs, and tempting recipes, we often want to forward them to our circle of friends, share them with relatives and friends, and check them again at our own convenience. So that you can’t find it when you want to see it again. So let’s learn how to forward articles on WeChat! How to forward articles on WeChat? How to forward articles on WeChat 1. If it is a link to your circle of friends, you can share it directly to your circle of friends. If it is an article posted by someone else, you can only press and hold to copy, then press and hold the camera icon in the upper right corner for three seconds, paste the text, and then Post, if you want to forward other people's pictures, you must first save the pictures to your phone and then choose to upload. 2

How to forward a video account to your own video account? How to monitor and analyze the forwarding effect? How to forward a video account to your own video account? How to monitor and analyze the forwarding effect? Mar 27, 2024 pm 03:41 PM

Today, when video creation and sharing are popular, video accounts have become the first choice platform for many people to showcase their talents and opinions. This article will discuss in detail how to forward other people’s wonderful videos to your own video account so that you can better share and promote high-quality content. 1. Understand the features and functions of the video account platform. Before considering forwarding other people’s videos to your own video account, you must first be familiar with the features and functions of the video account platform. Video account is a content sharing platform with video as the core, where users can publish, create and share various video contents. Some important aspects include: Forwarding function: Video account platforms usually provide a forwarding function, allowing users to share other people's videos to their own video accounts. Source video identification: When forwarding, the information of the original video will usually be retained, including

php-fpm process management skills and example analysis php-fpm process management skills and example analysis Jul 08, 2023 am 08:03 AM

Overview of PHP-FPM process management skills and example analysis: In PHP web development, PHP-FPM (FastCGIProcessManager) is a process manager responsible for processing requests from the web server. It uses an event-based model to manage PHP processes and provides more efficient request processing capabilities. This article will introduce some PHP-FPM process management skills and analyze them with examples. 1. Process pool adjustment skills: 1.1 Adjust the number of processes: According to the server

Building a Discuz forum from scratch: detailed tutorials and case analysis Building a Discuz forum from scratch: detailed tutorials and case analysis Mar 15, 2024 am 08:09 AM

Building a Discuz forum from scratch: detailed tutorials and case analysis With the development of the Internet, forums, as an important social communication platform, occupy an important position in the network. As one of the most popular forum systems in China, Discuz has the characteristics of high stability, easy customization and rich plug-ins, and is deeply loved by users. In this article, we will introduce how to build a Discuz forum from scratch, including detailed tutorial steps and case analysis, and will also provide specific code examples. Step One: Server Environment

Avoiding infinite loops and example analysis in PHP language development Avoiding infinite loops and example analysis in PHP language development Jun 10, 2023 pm 03:01 PM

In PHP language development, infinite loop is a common type of error. The occurrence of an infinite loop will cause the program to fail to execute normally, occupy a large amount of system resources, and even cause the system to crash. Therefore, avoiding infinite loops is a very important part of PHP program development. What is an infinite loop? An infinite loop refers to a loop structure in a program. When the condition is always true, the loop will continue until the program crashes or is forced to terminate. An infinite loop is also called an infinite loop because it has no end condition and will continue to loop. In this situation

See all articles