38. Please briefly describe the difference between forward and redirect

(1). From the address bar display

  1. Forward is the server requesting resources. The server directly accesses the URL of the target address, reads the response content of that URL, and then sends the content to the browser. The browser does not know where the content sent by the server comes from, so it The address bar is still the original address.
  2. Redirect means that the server sends a status code based on logic to tell the browser to request that address again. So the address bar shows the new URL.

(2). In terms of data sharing

  1. forward: The forwarded page and the forwarded page can share the data in the request.
  2. redirect: Data cannot be shared.

(3). From the point of use

  1. forward: Generally used when the user logs in, forwarded to the corresponding module according to the role.
  2. Redirect: Generally used to return to the main page and jump to other websites when the user logs out.

(4). In terms of efficiency

  1. forward: high.
  2. redirect: low.

Guess you like

Origin blog.csdn.net/zhu_fangyuan/article/details/108820874