Web download files and jumps

Source: Internet
Author: User

Statement: The material used in this column is written by the VIP students of the Kay Academy, who has the right to be anonymous and has the final right to interpret the article; The Edith Academy is designed to promote students to learn from each other on the basis of public notes.

You can use the Web. xml file to identify the file type for download if the file is not downloaded directly from the JSP and servlet. If you want to download through a servlet, you can download it as follows:

However, there are two drawbacks to downloading the words: one is we do not know the size of the file and download progress, the second is that we download the file name is not visible, so we did the following:

So we can get the file size download progress and file name.

There are two ways to jump from one page to another in the development web app: Jump
Redirect: With the browser jump (this method can not be used two times), response to the browser with a jump, the browser will be a good jump.
Forwarding: The server internal jump request to jump, through the Getrequestdispatcher () method to forward, and then go through the ForWord () method to jump, jump words in the browser display address unchanged.

Experimental test redirection and forwarding:

REDIRECT Test

Forward test:

The difference between redirection and forwarding
1. The number of requests is different, the redirect requests a total of two servers, forwarding is a user request may go through the N servlet page by return to the user browser, is a request multiple processing process;

2. The change of link during the jump, redirect in the jump request two times the server and is two different link address, in the browser's address bar can see two times is changed; forwarding during a jump the browser requests a server, the server passes n servlet pages and does not change the requested link address , because the user only requested once, so throughout the jump process the link address is not changed, in the browser's address bar can be seen

3. For different purposes, redirection is simply to allow users to access a new link, while forwarding is the server to get the user's request content and need to do a part of the processing, so the two purposes of different

Attribute ("name", "AAA"); Register AAA in Name

Web download files and jumps

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.