pom.xml

<properties> <springframework.version> 4.3.13.RELEASE </springframework.version> <org.slf4j.version>1.7.5 </org.slf4j.version> <hibernate.version>4.3.5.Final </hibernate.version> <org.aspectj-version>1.7.4 </org.aspectj-version> </properties> ============================================================================================== <!-- MySql --> <dependency> <groupId>mysql </groupId> <artifactId>mysql-connector-java </artifactId> <version>5.1.17 </version> </dependency> <!-- Hibernate --> <dependency> <groupId>org.hibernate </groupId> <artifactId>hibernate-core </artifactId> <version>${hibernate.version} </version> </dependency> <dependency> <groupId>org.hibernate </groupId> <artifactId>hibernate-entitymanager </artifactId> <version>${hibernate.version} </version> </dependency> <!-- Apache Commons DBCP --> <dependency> <groupId>commons-dbcp </groupId> <artifactId>commons-dbcp </artifactId> <version>1.4 </version> </dependency> <!-- Spring ORM --> <dependency> <groupId>org.springframework </groupId> <artifactId>spring-orm </artifactId> <version>4.3.13.RELEASE </version> </dependency> <dependency> <groupId>org.springframework </groupId> <artifactId>spring-webmvc </artifactId> <version>4.3.13.RELEASE </version> </dependency> <dependency> <groupId>org.springframework </groupId> <artifactId>spring-web </artifactId> <version>4.3.13.RELEASE </version> </dependency> <!-- Servlet --> <dependency> <groupId>javax.servlet </groupId> <artifactId>servlet-api </artifactId> <version>2.5 </version> <scope>provided </scope> </dependency> <dependency> <groupId>javax.servlet.jsp </groupId> <artifactId>jsp-api </artifactId> <version>2.1 </version> <scope>provided </scope> </dependency> <dependency> <groupId>javax.servlet </groupId> <artifactId>jstl </artifactId> <version>1.2 </version> </dependency> <!-- Form Validation using Annotations --> <dependency> <groupId>javax.validation </groupId> <artifactId>validation-api </artifactId> <version>1.1.0.Final </version> </dependency> <dependency> <groupId>org.hibernate </groupId> <artifactId>hibernate-validator </artifactId> <version>4.1.0.Final </version> </dependency> <!-- Logging --> <dependency> <groupId>org.slf4j </groupId> <artifactId>slf4j-api </artifactId> <version>${org.slf4j.version} </version> </dependency> <dependency> <groupId>org.slf4j </groupId> <artifactId>jcl-over-slf4j </artifactId> <version>${org.slf4j.version} </version> <scope>runtime </scope> </dependency> <dependency> <groupId>org.slf4j </groupId> <artifactId>slf4j-log4j12 </artifactId> <version>${org.slf4j.version} </version> <scope>runtime </scope> </dependency> <!-- JAXB Related --> <!-- API, java.xml.bind module --> <dependency> <groupId>jakarta.xml.bind </groupId> <artifactId>jakarta.xml.bind-api </artifactId> <version>2.3.2 </version> </dependency> <!-- Runtime, com.sun.xml.bind module --> <dependency> <groupId>org.glassfish.jaxb </groupId> <artifactId>jaxb-runtime </artifactId> <version>2.3.2 </version> </dependency>
                 

dispatcher-servlet.xml

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" 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 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <mvc:annotation-driven/> <context:component-scan base-package="com.acc.mvc"/> <!-- Here goes the view resolver --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/WEB-INF/views/" /> <property name="suffix" value=".jsp" /> </bean> <!--Spring-Hibernate Integration Code in dispatcher-servlet.xml--> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/lkm" /> <property name="username" value="root" /> <property name="password" value="root" /> </bean> <!-- Hibernate 4 SessionFactory Bean definition --> <bean id="hibernate4AnnotatedSessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="annotatedClasses"> <list> <value>com.acc.mvc.Login </value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect </prop> <prop key="hibernate.show_sql">true </prop> </props> </property> </bean> <bean id="loginDao" class="com.acc.mvc.LoginDao"> <property name="sessionFactory" ref="hibernate4AnnotatedSessionFactory"/> </bean> </beans>