Results 1 to 3 of 3

Thread: DispatcherServlet vs ContextLoaderListener?

  1. #1
    Join Date
    Oct 2010
    Location
    Chennai,India
    Posts
    45

    Default DispatcherServlet vs ContextLoaderListener?

    Dear All,

    In spring mvc,i have defined in web.xml DispatcherServlet and ContextLoaderListener.


    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    /WEB-INF/xxxxxxx-servlet.xml
    </param-value>
    </context-param>


    ----------------------------------

    <servlet>
    <servlet-name>xxxxxxx</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>

    ---------------------------------------
    How many Instances are created during the start up in container (service,dao,handler)?

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    Please use code tags when posting code.

    You have misconfigured your app. Your ContextLoaderListener must not load the servlet context, if you do this you will effectivly have 2 instances of everything.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Oct 2010
    Location
    Chennai,India
    Posts
    45

    Default

    Thanks..marten..

    I have very basic question. I understood in third party frameworks(i.example : DWR,struts,JSF,etcccc) are defining in ContextLoaderListener only. But in spring MVC how to define in web.xml? Is it necessary to use both configurations? If i am doing both how can I avoid 2 instance creation in spring mvc?

    Is it possible to configure third part framework (I.example : DWR,STRUTS,JSF…etcc)in dispatcher servlet file? i mean without ContextLoaderListener.

    Thanks,
    selva
    Last edited by selvapa; Nov 9th, 2010 at 05:50 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •