Javaweb Request forwarding and request redirect understanding

Source: Internet
Author: User

Request Forwarding Use method

Httpservletrequest.getrequestdispatcher ("login.jsp"). Forward (HttpServletRequest, servletresponse);

This request process is done exactly once by the requests object.

We can use filter to intercept the user's request, and then use this request to access other pages, when the server returns information to the browser when the request and response end.

Procedure similar to request request request response

Three request is the same object


Request Redirection Use Method

Httpservletresponse.sendredirect ("http://192.168.101.243:8881/simpleshop_mvc/jsp/login.jsp");


Request redirection is the interception of this request by the browser, which is then redirected again by browsing to initiate a request to access the redirected data.

The process is similar to request response request response


Two request is two objects


Javaweb Request forwarding and request redirect understanding

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.