Jump and redirect the difference


Jump
    1. request completion
    essence 2. The jump is to forward requests and responses within the server, transmitted to the next resource
    3. If there is data in the request, each of the jump to a resource can get a data (from start to finish only a request object)
    4. Since the server requests and responses is to jump forward back and forth inside the server, the address in the address bar of a browser is not affected, so that still the first secondary address requesting
    5. resource address provided at the time of the jump, the front path generally plus /
        e.g. String path = "/a.html";

redirect
    1. completion response
    nature of the redirection is 2 the resource path response back to the browser (in response to header information), allows the browser to send a new request to this new address
    3. If there is data in the redirection request new resources can not get this data (redirect will send a new request, but the data on an old request)
    4. due to redirect the browser to make a new request, the address in the browser address bar will become the address of the new request
    5. in the set Redirection of resources addresses, in front of the path is generally not add /
        example String path = "a.html";
        but if you have to add /, then add a project also requires an additional name
        such as String path = "/ web_test / a.html ";
        but also can dynamically fetch items: req.getContextPath ()
            String path = req.getContextPath()+"/a.html";


Guess you like

Origin www.cnblogs.com/yxj808/p/12017844.html