Announcement Announcement Module
Collapse
No announcement yet.
How do they go hand in hand? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do they go hand in hand?

    Hi,

    I have some basic experience of spring framework but never really managed to develop a whole application with it because of lack of time. I am now planning to use spring to develop a web application.

    However I was wondering how spring framework and a application server (such as JBoss and Tomcat) go hand in hand.

    What I mean is the following; When we build a *.war file we have a web.xml file. In this file we declare all the servlet and their mappings. The application server will then use this information to handle requests for the *.war deployed.

    When using spring we only declare one servelt here which will be the DispatcherServlet. This will then (presumably) load another xml file which will have the actual servlet of the web application and their mappings.

    So isn't the DispatcherServlet just doing the same thing the application server was already developed to do?

    I am only asking this to better understand how spring framework works under the hood.

    Thanks and Regards,
    Sim085

  • #2
    It's true that the application server will run DispatcherServlet as it runs any servlet. But DispatcherServlet doesn't hand off to other servlets -- if you're using Spring MVC, anyway, DispatcherServlet hands off to a Controller, which does a lot of work for you as compared to a plain servlet.

    Comment


    • #3
      Originally posted by jacobmattison View Post
      It's true that the application server will run DispatcherServlet as it runs any servlet. But DispatcherServlet doesn't hand off to other servlets -- if you're using Spring MVC, anyway, DispatcherServlet hands off to a Controller, which does a lot of work for you as compared to a plain servlet.
      Thanks for the reply. So the application server would in reality only see an application with a single servlet while the DispatcherServlet would be managing all the controller that make out the whole application. Is that right?

      Thanks again,
      Sim085

      Comment


      • #4
        Well, basically anything that's configured in web.xml is stuff that the application server will know about. That certainly includes the DispatcherServlet (possibly more that one instance of it), the ContextLoaderListener, and possibly other stuff such as Filters (again, if you use DelegatingProxyFilter you've got a situation where the application server sees one filter -- Spring code -- that actually hands off to a different Spring-managed filter).

        Comment


        • #5
          Originally posted by jacobmattison View Post
          Well, basically anything that's configured in web.xml is stuff that the application server will know about. That certainly includes the DispatcherServlet (possibly more that one instance of it), the ContextLoaderListener, and possibly other stuff such as Filters (again, if you use DelegatingProxyFilter you've got a situation where the application server sees one filter -- Spring code -- that actually hands off to a different Spring-managed filter).
          Thanks for your reply I understand much better now!

          Thanks again,
          Sim085

          Comment

          Working...
          X