Several Methods for passing parameters between different pages are discussed. Page Parameters

Source: Internet
Author: User

Several Methods for passing parameters between different pages are discussed. Page Parameters

Several Methods for passing parameters between different pages (Li Sheng)

Because the web system uses the http protocol to transmit data between the browser and the server, http is a stateless protocol. There are several ways to transfer data between different pages.

Method 1: Form Transmission

Form passing parameters are the simplest and most basic parameter passing methods. Note: Use of the form Element hide button

Method 2: url with Parameters

Url with parameters: url? Parameter Name 1 = value 1 & parameter name 2 = value 2.

Method 3: request object

You can bind data to a request object and read and write data through the getAttribute and setAttribute methods of the request object.

Method 4: user session object

You can bind data to a session object and read and write data through the getAttribute and setAttribute methods of the session object.

Method 5: application Object

You can bind data to an application object and read and write data through the getattivity method and setAttribute method of the application object.

Method 6: cookie object

Data can be written to the cookie file of the client browser.

Method 1 and method 2 can only transmit string parameters. Method 3, Method 4, Method 5, and Method 6 can transmit objects (Method 6 requires Object serialization for storage)

Method 1, method 2, method 3 data transmission can only request the page to obtain data, and method 4, Method 5, and Method 6 can obtain data objects on multiple different pages

The data objects stored in Method 4 and 6 are information related to a user. The difference is that method 4 saves the data to the server memory, and Method 6 saves the data to the client memory.

Method 5: the stored data objects are information related to all users, and the data is also saved to the server memory.

The above discussion about how to implement parameter transfer between different pages is all the content shared by the editor. I hope you can give us a reference and support the customer's house.

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.