Thursday, November 26, 2015

ContextLoaderListener

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>SpringMVCloginExample</display-name>
  <!-- <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> -->
 
  <servlet>
<servlet-name>springLoginApplication</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!--  <init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath://resource//springWeb.xml</param-value>
</init-param>-->
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
      <servlet-name>springLoginApplication</servlet-name>
      <url-pattern>/</url-pattern>
   </servlet-mapping>
 
</web-app>

This configuration does not searches for applicationcontext.xml file but also searches for springLoginApplication-servlet.xml in WEB-INF folder .You can import other xml file in springLoginApplication-servlet.xml WEB-INF folder

content of springLoginApplication-servlet.xml  and springBeanConfiguration.xml file must be within
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:component-scan base-package="com.jcg" />

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
      <property name="prefix" value="/jsp/" />
      <property name="suffix" value=".jsp" />
     
   </bean>
 

   
   
   
     
 
   
     
 
 




<import resource="springBeanConfiguration.xml"/>


</beans>

No comments:

Post a Comment