Hello everyone,
I am confused between the High level response-request architecture,and MVC architecture.
I use HFSJ book.
In that book, the second chapter shows the request-response cycle.
it says that:-
1. The user enters the
servlet request.
2. Request goes to Web Container.
3. Web Container creates the Request and Response objects.
4. Web container finds the correct servlet based on the URL.
5. On finding the correct servlet, it creates the
thread for that servlet.
6. Web Container puts the user request in the request object and passes the object to the thread.
7. Servlet thread then calls the service() method.
8. On the service method in turn, calls the doGet()or doPost() method depending on the GET or POST request.
9. doGet()or doPost() then will dynamically generate the response page.
10. This response page will then be put into the Response Object.
11. Web Container then will convert this response object into HttpResponse.
12. This HttpResponse is then sent to then client.
13. Web Container the destroys the request and response objects.
MVC architecture Eg.on Page 71 says that:-
1. The client makes a request for form.html
2. The Container retrieves the form.html page.
3. The Container returns the page to the browser.
4. The user answers the questions on the form and sends the request data to the container.
5. Web container finds the correct servlet based on the URL and passes the request to the servlet.
6. The Servlet then calls the BeerExpert Component for help.
7. The expert class returns an answer,which the servlet adds to the request object.
8. The servlet forwards the request to the
JSP.
9. The JSP gets the answer from the request object.
10.The JSP generates the page for the container.
11.The Container returns the page to the user.
The questions are:-
1.When or in what situations,do we use either of the architecture?
2.In,MVC architecture,from where did the BeerExpert Component and Result.jsp come from?
3.After comparing these 2 architectures,
(i) On finding the correct servlet,
(a)It creates the thread for that servlet. Web Container puts the user request in the request object and passes the object to the thread.
(b)The Servlet then calls the BeerExpert Component for help.
Just explain me the complete scenerio.