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.