web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>SMU</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
</web-app>
struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<package name="default" extends="struts-default">
<action name="browseAllStations" class="stationAction" method="browseAllStations">
<result name="success">/menu.jsp</result>
</action>
<action name="browseAllRequirements" class="requirementAction" method="browseAllRequirements">
<result name="success">/main.jsp</result>
<interceptor-ref name="defaultStack"></interceptor-ref>
</action>
<action name="addScore" class="scoreAction" method="addScore">
<result name="success">/addScore_success.jsp</result>
<result name="error">/addScore.jsp</result>
<interceptor-ref name="defaultStack"></interceptor-ref>
</action>
</package>
</struts>
applicationContext.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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" xmlns:tx="http://www.springframework.org/schema/tx">
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url"
value="jdbc:mysql://localhost:3306/SMU?useUnicode=true&characterEncoding=utf-8">
</property>
<property name="username" value="root"></property>
<property name="password" value="123456"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/smu/model/Teacher.hbm.xml</value>
<value>com/smu/model/Station.hbm.xml</value>
<value>com/smu/model/Requirement.hbm.xml</value>
<value>com/smu/model/Case.hbm.xml</value>
<value>com/smu/model/Student.hbm.xml</value>
<value>com/smu/model/Score.hbm.xml</value>
<value>com/smu/model/System.hbm.xml</value></list>
</property></bean>
<bean id="stationDAO" class="com.smu.dao.impl.StationDAO">
<property name="sessionFactory">
<ref bean="sessionFactory"></ref>
</property>
</bean>
<bean id="stationService" class="com.smu.service.impl.StationService">
<property name="stationDAO" ref="stationDAO"></property>
</bean>
<bean id = "stationAction" class="com.smu.action.StationAction">
<property name="stationService" ref="stationService"></property>
</bean>
<bean id="requirementDAO" class="com.smu.dao.impl.RequirementDAO">
<property name="sessionFactory">
<ref bean="sessionFactory"></ref>
</property>
</bean>
<bean id="requirementService" class="com.smu.service.impl.RequirementService">
<property name="requirementDAO" ref="requirementDAO"></property>
</bean>
<bean id = "requirementAction" class="com.smu.action.RequirementAction">
<property name="requirementService" ref="requirementService"></property>
</bean>
<bean id="scoreDAO" class="com.smu.dao.impl.ScoreDAO">
<property name="sessionFactory">
<ref bean="sessionFactory"></ref>
</property>
</bean>
<bean id="scoreService" class="com.smu.service.impl.ScoreService">
<property name="scoreDAO" ref="scoreDAO"></property>
</bean>
<bean id = "scoreAction" class="com.smu.action.ScoreAction">
<property name="scoreService" ref="scoreService"></property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" /></beans>