What is the DispatcherServlet and what is it used for?

Deepika Sahu answered on December 24, 2022 Popularity 7/10 Helpfulness 1/10

Contents


More Related Answers

  • dispatcher servlet as its web application context
  • Use Java to configure DispatcherServlet in the servlet container
  • Purpose of servlet dispatcher
  • Dispatcher
  • What is the use of DispatcherServlet in Spring MVC?

  • What is the DispatcherServlet and what is it used for?

    0
    Popularity 7/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Tags: whatever
    Link to this answer
    Share Copy Link
    Contributed on Dec 24 2022
    Deepika Sahu
    0 Answers  Avg Quality 2/10

    Closely Related Answers



    0

    DispatcherServlet is part of the Spring MVC. It works as a front controller, that is, it handles all the incoming HTTP requests. Spring MVC is a web framework that allows you to develop traditional web applications where UI apps are also part of the backend. However, you'll develop RESTful web services and the UI will be based on the React JavaScript library, therefore we'll keep the Servlet Dispatcher role limited to implementing the REST endpoints using @RestController.

    Let's have a look at the flow of a user request in Spring MVC for the REST controller:

    The user sends the HTTP request, which is received by DispatcherServlet.

    DispatcherServlet passes the baton to HandlerMapping. HandlerMapping does the job of finding the correct controller for the requested URI and passes it back to DispatcherServlet.

    DispatcherServlet then makes use of HandlerAdaptor to handle Controller.

    HandlerAdaptor calls the appropriate method inside Controller.

    Controller then executes the associated business logic and forms the response.

    Spring makes use of the marshaling/unmarshalling of request and response objects for JSON/XML conversion from Java and vice versa.

    Popularity 9/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Feb 18 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.