本系統使用Struts2+Spring+Hibernate架構,數據庫使用MySQL,鏈接池使用c3p0。普遍用於駕校管理,包含學員管理、車輛管理、教練員工管理、用車管理、考試管理、成績繳費管理等功能,除了管理員能控制修改這些信息之外,教練也可對其下學員的約車信息和考試管理信息進行增刪改查。java
正在作畢設的學生,或者須要項目實戰練習的Java學習者mysql
新增繳費信息
ajax
教練後臺-考試管理
spring
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">false</prop> <prop key="hibernate.format_sql">false</prop> <prop key="hibernate.connection.provider_class">com.jolbox.bonecp.provider.BoneCPConnectionProvider</prop> <prop key="hibernate.connection.driver_class">com.mysql.jdbc.Driver</prop> <prop key="hibernate.connection.url"> <![CDATA[jdbc:mysql://localhost:3306/driverschool?useUnicode=true&characterEncoding=utf8]]></prop> <prop key="hibernate.connection.username">root</prop> <prop key="hibernate.connection.password">root123</prop> <prop key="bonecp.partitionCount">1</prop> <prop key="bonecp.maxConnectionsPerPartition">10</prop> <prop key="bonecp.minConnectionsPerPartition">5</prop> <prop key="bonecp.acquireIncrement">1</prop><!-- #每次新增鏈接的數量 --> <prop key="bonecp.connectionTimeout">3000</prop><!-- #鏈接超時時間閥值,獲取鏈接時,超出閥值時間,則獲取失敗,毫秒爲單位 --> <prop key="bonecp.poolAvailabilityThreshold">20</prop><!-- #鏈接池閥值,當 可用鏈接/最大鏈接 < 鏈接閥值 時,建立新的鏈接 --> <prop key="bonecp.idleConnectionTestPeriod">30</prop><!-- 測試鏈接有效性的間隔時間,單位分鐘 --> <prop key="bonecp.idleMaxAge">240</prop><!-- 鏈接的空閒存活時間,當鏈接空閒時間大於該閥值時,清除該鏈接 --> <prop key="bonecp.statementsCacheSize">5</prop><!-- 語句緩存個數 --> <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop> <prop key="hibernate.connection.release_mode">auto</prop> <prop key="hibernate.autoReconnect">true</prop> <prop key="hibernate.connection.autocommit">true</prop> <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.use_second_level_cache">true</prop> </props> </property> <property name="mappingResources"> <list> <value>com/driverSchool/entity/Bookcar.hbm.xml</value> <value>com/driverSchool/entity/Car.hbm.xml</value> <value>com/driverSchool/entity/Pay.hbm.xml</value> <value>com/driverSchool/entity/Student.hbm.xml</value> <value>com/driverSchool/entity/Test.hbm.xml</value> <value>com/driverSchool/entity/User.hbm.xml</value> </list> </property> </bean>
<struts> <constant name="struts.i18n.encoding" value="UTF-8" /> <constant name="struts.locale" value="zh_CN" /> <constant name="struts.objectFactory" value="spring" /> <package name="default" extends="struts-default"> <interceptors> <!-- 安全信息過濾,用戶session爲空則強制退出 --> <interceptor name="sessionCheck" class="com.driverSchool.util.SessionCheck"> <!-- 不須要攔截的方法 --> <param name="excludeMethods"> login </param> </interceptor> <!-- 攔截器棧,包含SESSION攔截和默認攔截器 --> <interceptor-stack name="authInterceptor1"> <interceptor-ref name="sessionCheck" /> <interceptor-ref name="defaultStack" /> </interceptor-stack> </interceptors> <default-interceptor-ref name="authInterceptor1"></default-interceptor-ref> <!-- 注意global-results必須在global-exception-mappings前面 --> <global-results> <result name="reLogin">/login.jsp</result> <result name="to_index">/index.jsp</result> </global-results> <global-exception-mappings> <!-- 此處定義的result對應於上面的global-results內 捕獲全部異常 --> <exception-mapping result="error" exception="java.lang.Exception"> </exception-mapping> <exception-mapping result="errorSql" exception="java.sql.SQLException"> </exception-mapping> </global-exception-mappings> <action name="userAction_*" class="userAction" method="{1}"> <result name="to_info">/info.jsp</result> <result name="to_user_list">/user_list.jsp</result> <result name="to_addOrEditUser">/user_addAndEdit.jsp</result> <result name="to_user_listAction" type="redirectAction">userAction_findUserAll</result> </action> <action name="bookcarAction_*" class="bookcarAction" method="{1}"> <result name="to_bookcar_list">/bookcar_list.jsp</result> <result name="to_addOrEditBookcar">/bookcar_addAndEdit.jsp</result> <result name="to_bookcar_listAction" type="redirectAction">bookcarAction_findBookcarAll</result> </action> <action name="carAction_*" class="carAction" method="{1}"> <result name="to_car_list">/car_list.jsp</result> <result name="to_addOrEditCar">/car_addAndEdit.jsp</result> <result name="to_car_listAction" type="redirectAction">carAction_findCarAll</result> </action> <action name="payAction_*" class="payAction" method="{1}"> <result name="to_pay_list">/pay_list.jsp</result> <result name="to_addOrEditPay">/pay_addAndEdit.jsp</result> <result name="to_pay_listAction" type="redirectAction">payAction_findPayAll</result> </action> <action name="studentAction_*" class="studentAction" method="{1}"> <result name="to_student_list">/student_list.jsp</result> <result name="to_addOrEditStudent">/student_addAndEdit.jsp</result> <result name="to_student_listAction" type="redirectAction">studentAction_findStudentAll</result> </action> <action name="testAction_*" class="testAction" method="{1}"> <result name="to_test_list">/test_list.jsp</result> <result name="to_addOrEditTest">/test_addAndEdit.jsp</result> <result name="to_test_listAction" type="redirectAction">testAction_findTestAll</result> </action> </package> </struts>
applicationContext.xmlsql
<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.0.xsd"> <import resource="datebase.xml" /> <bean id="userDao" class="com.driverSchool.dao.UserDao"> <property name="ht" ref="hibernatetemplate"></property> </bean> <bean id="userService" class="com.driverSchool.service.impl.UserServiceImpl"> <property name="dao" ref="userDao"></property> </bean> <bean id="userAction" class="com.driverSchool.action.UserAction"> <property name="biz" ref="userService"></property> </bean> <bean id="bookcarDao" class="com.driverSchool.dao.BookcarDao"> <property name="ht" ref="hibernatetemplate"></property> </bean> <bean id="bookcarService" class="com.driverSchool.service.impl.BookcarServiceImpl"> <property name="dao" ref="bookcarDao"></property> </bean> <bean id="bookcarAction" class="com.driverSchool.action.BookcarAction"> <property name="biz" ref="bookcarService"></property> <property name="sbiz" ref="studentService"></property> <property name="cbiz" ref="carService"></property> </bean> <bean id="carDao" class="com.driverSchool.dao.CarDao"> <property name="ht" ref="hibernatetemplate"></property> </bean> <bean id="carService" class="com.driverSchool.service.impl.CarServiceImpl"> <property name="dao" ref="carDao"></property> </bean> <bean id="carAction" class="com.driverSchool.action.CarAction"> <property name="biz" ref="carService"></property> </bean> <bean id="payDao" class="com.driverSchool.dao.PayDao"> <property name="ht" ref="hibernatetemplate"></property> </bean> <bean id="payService" class="com.driverSchool.service.impl.PayServiceImpl"> <property name="dao" ref="payDao"></property> </bean> <bean id="payAction" class="com.driverSchool.action.PayAction"> <property name="biz" ref="payService"></property> <property name="sbiz" ref="studentService"></property> </bean> <bean id="studentDao" class="com.driverSchool.dao.StudentDao"> <property name="ht" ref="hibernatetemplate"></property> </bean> <bean id="studentService" class="com.driverSchool.service.impl.StudentServiceImpl"> <property name="dao" ref="studentDao"></property> </bean> <bean id="studentAction" class="com.driverSchool.action.StudentAction"> <property name="biz" ref="studentService"></property> </bean> <bean id="testDao" class="com.driverSchool.dao.TestDao"> <property name="ht" ref="hibernatetemplate"></property> </bean> <bean id="testService" class="com.driverSchool.service.impl.TestServiceImpl"> <property name="dao" ref="testDao"></property> </bean> <bean id="testAction" class="com.driverSchool.action.TestAction"> <property name="biz" ref="testService"></property> <property name="sbiz" ref="studentService"></property> </bean> </beans>
//controller public String login() { User user = biz.findUserByUsernameAndPwd(username, pwd); if (user == null) { ActionContext.getContext().put("msg", "該用戶不存在,請從新登陸!"); return "reLogin"; } else { ActionContext.getContext().getSession().put("user", user); ActionContext.getContext().getSession().put("uname", username); ActionContext.getContext().getSession().put("uid", user.getId()); ActionContext.getContext().getSession().put("role", user.getRole()); ActionContext.getContext().put("msg", ""); return "to_index"; } } //jsp <div class="container"> <div class="line bouncein"> <div class="xs6 xm4 xs3-move xm4-move"> <div style="height:150px;"></div> <div class="media media-y margin-big-bottom"></div> <form action="<%=basePath%>userAction_login.action" method="post"> <div class="panel loginbox"> <div class="text-center margin-big padding-big-top"> <h1>駕校信息管理平臺</h1> </div> <div class="panel-body" style="padding:30px; padding-bottom:10px; padding-top:10px;"> <div class="form-group"> <div class="field field-icon-right"> <input type="text" class="input input-big" name="username" placeholder="登陸帳號" data-validate="required:請填寫帳號" /> <span class="icon icon-user margin-small"></span> </div> </div> <div class="form-group"> <div class="field field-icon-right"> <input type="password" class="input input-big" name="pwd" placeholder="登陸密碼" data-validate="required:請填寫密碼" /> <span class="icon icon-key margin-small"></span> </div> </div> </div> <div style="padding:30px;"> <input type="submit" class="button button-block bg-main text-big input-big" value="登陸"> </div> </div> </form> </div> </div> </div>
程序有問題聯繫程序幫數據庫
其餘ssm,springboot版本後續迭代更新,持續關注緩存