1.1 Creating a project
1.2 Add Jar Pack
1.3 Change configuration file
1.3.1 Connection Database
Configuration of the 1.3.2 Spring file
2 project configuration
Applicationcontext-dao.xml
<bean id= "EmployeeDAO" class= "Cn.itcast.ssh.dao.impl.EmployeeDaoImpl" parent= "Basedao" >
</bean>
<bean id= "Leavebilldao" class= "Cn.itcast.ssh.dao.impl.LeaveBillDaoImpl" parent= "Basedao" >
</ Bean>
Here is a description:
Parent= "Basedao" is equivalent to
<bean id= "Basedao" abstract= "true" > <propertyname= "sessionfactory" ref= "Sessionfactory"
></ Property>
</bean>
Applicationcontext-service.xml
<bean id= "EmployeeService" class= "Cn.itcast.ssh.service.impl.EmployeeServiceImpl" > <property name= "employ" Eedao "ref=" EmployeeDAO "></property> <!--employees--> </bean> <bean id=" Leavebillservice "CLA ss= "Cn.itcast.ssh.service.impl.LeaveBillServiceImpl" > <property name= "Leavebilldao" ref= "Leavebilldao" > </property> <!--leave single--> </bean> <bean id= "WorkflowService class=" Cn.itcast.ssh.service.impl. Workflowserviceimpl "> <property name=" repositoryservice "ref=" Repositoryservice "></property> <PR Operty name= "Runtimeservice" ref= "Runtimeservice" ></property> <property name= "Taskservice" Taskservice "></property> <property name=" Formservice "ref=" Formservice "></property> <prope Rty name= "Historyservice" ref= "Historyservice" ></property> <property name= "Leavebilldao" Leavebilldao "></property> </bean>
Applicationcontext-action.xml
<bean id= "loginaction" class= "Cn.itcast.ssh.web.action.LoginAction" scope= "prototype" >
<property Name = "EmployeeService" ref= "EmployeeService" ></property>
</bean>
<bean id= "Leavebillaction" "Class=" Cn.itcast.ssh.web.action.LeaveBillAction "scope=" prototype "> <property name=" Leavebillservice "
ref= "Leavebillservice" ></property>
</bean>
<bean id= "Workflowaction" Cn.itcast.ssh.web.action.WorkflowAction "scope=" prototype ><!--MVC defaults to a single example, to multiple cases-->
<property name= " WorkflowService "ref=" WorkflowService "></property> <property name=" Leavebillservice "ref="
Leavebillservice "></property>
</bean>
Activiti-context.xml, configuring Activiti tables and things and service without creating a process engine to directly introduce
<!--Spring is responsible for creating the configuration file for the process engine--> <bean id= "processengineconfiguration" class= " Org.activiti.spring.SpringProcessEngineConfiguration "> <!--data source--> <property name=" DataSource "ref=" DataSource "/> <!--configuration transaction manager, unified transaction--> <property name=" TransactionManager "ref=" Transmanager "/> <!-- Set up a table policy, if there are no tables, automatically create a table--> <property name= "Databaseschemaupdate" value= "true"/> </bean> <!--create process engine objects- > <bean id= "processengine" class= "Org.activiti.spring.ProcessEngineFactoryBean" > <property name= " Processengineconfiguration "ref=" processengineconfiguration/> </bean> <!--equivalent to the following code Repositoryservicie
Repositoryservice = Processengine.getrepositoryservice ();
Runtimeservicie Repositoryservice = Processengine.getruntimeservicie ();
Taskservicie Taskservicie = Processengine.gettaskservicie ();
Historyservicie Historyservicie = Processengine.gethistoryservicie (); --> <!--by the process engine object, the method provided to create the service--> <!--static injection of the Activiti workflow used in the project is setRighteousness Processengine can point out service--> <bean id= "Repositoryservice" factory-bean= "Processengine" Getrepositoryservice "/> <bean id=" Runtimeservice "factory-bean=" Processengine "factory-method=" Getruntimeservice "/> <bean id= taskservice" factory-bean= "Processengine" factory-method= "GetTaskService"/ > <bean id= "historyservice" factory-bean= "Processengine" factory-method= "Gethistoryservice"/> <bean "id="
Formservice "factory-bean=" Processengine "factory-method=" Getformservice "/>"
The configuration of Struts
<struts> <!--configuration mode for development mode, automatically load Struts.xml and display error message--> <constant name= "Struts.devmode" value= "true"/&
Gt <!--set the theme of the page as a simple theme, remove the style provided by STRUTS2 development--> <constant name= "struts.ui.theme" value= "simplicity"/> Name= "Default" namespace= "/" extends= "Struts-default" > <!--Interceptor configuration--> <interceptors> <!--definition An interceptor for Interceptor login--> <interceptor name= "Logininterceptor" class= "Cn.itcast.ssh.utils.LoginInteceptor" ></ Interceptor> <!--define an interceptor stack--> <interceptor-stack name= "Systemstack" > <interceptor-ref name= "Defaultstack"/> <interceptor-ref name= "Logininterceptor"/> </interceptor-stack> </interceptor S> <!--define system default Interceptor global--> <default-interceptor-ref name= "Systemstack"/> <!--global results View--> & lt;global-results> <result name= "Login" type= "redirect" > login.jsp </result> </global-re Sults> <action name= "loginaction_*" class= "loginaction" method= "{1}" > <result name= "Success" >web-inf/views/main.js P</result> <result name= "Top" >WEB-INF/views/top.jsp</result> <result name= "left" >w
Eb-inf/views/left.jsp</result> <result name= "Welcome" >WEB-INF/views/welcome.jsp</result> </action> <action name= "leavebillaction_*" class= "leavebillaction" method= "{1}" > <res Ult name= "Home" >WEB-INF/views/leaveBill/list.jsp</result> <result name= "Input" >web-inf/views/le Avebill/input.jsp</result> <result name= "Save" type= "Redirectaction" > <param name= "Acti" Onname ">leaveBillAction_home.action</param> </result> </action> <action name=
"Workflowaction_*" class= "workflowaction" method= "{1}" > <result name= "list" type= "Redirectaction" > <param Name= "ActionName ">workflowAction_deployHome.action</param> </result> <result name=" Deployhome ">we b-inf/views/workflow/workflow.jsp</result> <result name= "task" >web-inf/views/workflow/task.jsp</ result> <result name= "image" >WEB-INF/views/workflow/image.jsp</result> <result name= "lis
Ttask "type=" redirectaction "> <param name=" ActionName ">workflowAction_listTask.action</param> </result> <result name= "Viewtaskform" type= "redirectaction" > <param name= "ActionName" ;/workflowaction_audit.action</param> </result> <result name= "Taskform" >web-inf/views/wo rkflow/taskform.jsp</result> <result name= "Viewhiscomment" >web-inf/views/workflow/taskformhis.jsp&
lt;/result> </action> </package> </struts>
Configuration database table
3 Flow chart