web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<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>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
hibernate.cfg.xml
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://192.168.199.149/hibernate</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.show_sql">true</property>
<mapping resource="com/snow/po/Student.hbm.xml"/>
<mapping resource="com/snow/po/Course.hbm.xml"/>
</session-factory>
</hibernate-configuration>
struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="default" namespace="/" extends="struts-default">
<action name="CourseAction" class="com.snow.action.CourseAction">
<result name="success">/course/list.jsp</result>
<result name="list" type="redirect">CourseAction!list</result>
<result name="update">/course/update.jsp</result>
<result name="detail">/course/detail.jsp</result>
</action>
<action name="StudentAction" class="com.snow.action.StudentAction">
<result name="select">/student/select.jsp</result>
<result name="center">/student/center.jsp</result>
</action>
</package>
</struts>
jdbc.properties
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://192.168.199.140/mymanager
username=root
password=root
User.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
package="org.hibernate.auction">
<class name="User" table="AuctionUser" lazy="true">
<comment>Users may bid for or sell auction items.</comment>
<id name="id">
<generator class="native"/>
</id>
<natural-id mutable="true">
<property name="userName"
length="10"/>
</natural-id>
<property name="password"
not-null="true"
length="15"
column="`password`"/>
<property name="email"/>
<component name="name">
<property name="firstName"
length="50"
not-null="true"/>
<property name="initial"
column="`initial`"/>
<property name="lastName"
length="50"
not-null="true"/>
</component>
<bag name="bids"
inverse="true"
cascade="save-update,lock">
<key column="bidder"/>
<one-to-many class="Bid"/>
</bag>
<bag name="auctions"
inverse="true"
cascade="save-update,lock">
<key column="seller"/>
<one-to-many class="AuctionItem"/>
</bag>
</class>
</hibernate-mapping>