当前位置: 代码迷 >> Web前端 >> SSH2.5配置文件 oa 一
  详细解决方案

SSH2.5配置文件 oa 一

热度:959   发布时间:2012-08-31 12:55:03.0
SSH2.5配置文件 oa 1
applicationContext.xml配置文件

<?xml version="1.0" encoding="UTF-8"?>
<!--
  - Middle tier application context definition for the image database.
  -->
<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:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

<!-- Configurer that replaces ${...} placeholders with values from a properties file -->
<!-- (in this case, JDBC-related settings for the dataSource definition below) -->
   
       <context:component-scan base-package="cn.wanghao"></context:component-scan>   
       <!-- 自动扫描待装配的bean-->
       <context:property-placeholder location="classpath:jdbc.properties"/>
       <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                <property name="configLocation"  value="classpath:hibernate.cfg.xml"></property>
                <property name="dataSource">
                    <bean class="com.mchange.v2.c3p0.ComboPooledDataSource">
                       <property name="jdbcUrl" value="${jdbcUrl}"></property>
                       <property name="driverClass" value="${driverClass}"></property>
                       <property name="user" value="${username}"> </property>
                       <property name="password" value="${password}"></property>
                    </bean>
                </property>   
      </bean>
      <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
  </bean>
  <!--加上@Transactional注释的表示使用事务管理 -->
  <tx:annotation-driven transaction-manager="transactionManager"/>

   <!--配置processEngine的bean -->
  <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">
       <!--jbpm配置文件在根目录中 -->
      <property name="jbpmCfg" value="jbpm.cfg.xml"></property>
      </bean>
      <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />
</beans>


hibernate.cfg.xml配置文件

<hibernate-configuration>
<session-factory>
    <!-- 注意方言 -->
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="show_sql">true</property>
<property name="hibernate.hbm2ddl.auto">update</property>


<mapping resource="cn/wanghao/domain/Role.hbm.xml"/>
    <mapping resource="cn/wanghao/domain/Department.hbm.xml" />
    <mapping resource="cn/wanghao/domain/User.hbm.xml" />
    <mapping resource="cn/wanghao/domain/Privilege.hbm.xml" />
    <mapping resource="cn/wanghao/domain/Forum.hbm.xml" />
    <mapping resource="cn/wanghao/domain/Topic.hbm.xml" />
    <mapping resource="cn/wanghao/domain/Reply.hbm.xml" />
   
   <!-- jbpm映射文件 -->
   <mapping resource="jbpm.repository.hbm.xml" />
       <mapping resource="jbpm.execution.hbm.xml" />
       <mapping resource="jbpm.history.hbm.xml" />
       <mapping resource="jbpm.task.hbm.xml" />
       <mapping resource="jbpm.identity.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>
<!-- 设置为开发模式 -->
<constant name="struts.devMode" value="true" />
<!-- 配置扩展名为.action -->
<constant name="struts.action.extension" value="action"></constant>
    <!-- 把主题设为简单struts标签的 -->
    <constant name="struts.ui.theme" value="simple" />
<package name="default" namespace="/" extends="struts-default">


    <!-- 声明CheckProvilege拦截器 -->
    <interceptors>
       <interceptor name="CheckProvilege" class="cn.wanghao.view.interecptor.CheckProvilege"></interceptor>
       <interceptor-stack name="myStack">
           <interceptor-ref name="CheckProvilege"></interceptor-ref>
           <interceptor-ref name="defaultStack"></interceptor-ref>
       </interceptor-stack>
    </interceptors>

    <!-- 声明默认拦截器栈 -->
<default-interceptor-ref name="myStack"></default-interceptor-ref>


<global-results>
  <result name="loginUI">/WEB-INF/jsp/userAction/loginUI.jsp</result>
  <result name="privilegeError">/WEB-INF/jsp/error/privilegeError.jsp</result>
</global-results>

<!--岗位action -->
    <action name="roleAction_*" class="roleAction" method="{1}">
<result name="list">/WEB-INF/jsp/roleAction/list.jsp</result>
<result name="addUI">/WEB-INF/jsp/roleAction/addUI.jsp</result>
<result name="editUI">/WEB-INF/jsp/roleAction/editUI.jsp</result>
<result name="setPrivilegeUI">/WEB-INF/jsp/roleAction/setPrivilegeUI.jsp</result>
<result name="tolist"  type="redirectAction">roleAction_list</result>
</action>
<!--部门action -->
<action name="departmentAction_*" class="departmentAction" method="{1}">
<result name="list">/WEB-INF/jsp/departmentAction/list.jsp</result>
<result name="addUI">/WEB-INF/jsp/departmentAction/addUI.jsp</result>
<result name="editUI">/WEB-INF/jsp/departmentAction/editUI.jsp</result>
                                                       <!-- parentId取值为departmentAction中的parentId的值 -->
<result name="tolist"  type="redirectAction">departmentAction_list?parentId=${parentId}</result>
</action>
<!--用户action -->
<action name="userAction_*" class="userAction" method="{1}">
<result name="list">/WEB-INF/jsp/userAction/list.jsp</result>
<result name="addUI">/WEB-INF/jsp/userAction/saveUI.jsp</result>
<result name="editUI">/WEB-INF/jsp/userAction/saveUI.jsp</result>
<result name="loginUI">/WEB-INF/jsp/userAction/loginUI.jsp</result>
<result name="logout">/WEB-INF/jsp/userAction/logout.jsp</result>
<result name="toindext"  type="redirect">/indexAction_index.action</result>
<result name="tolist"  type="redirectAction">userAction_list</result>
</action>

<!--主页,IndexAction类中的方法名,返回值,和result一致,将index bottom left right top 公用同一个 -->
<action name="indexAction_*" class="indexAction" method="{1}">
     <result name="{1}">/WEB-INF/jsp/indexAction/{1}.jsp</result>
</action>

<!--论坛管理action -->
<action name="forumManageAction_*" class="forumManageAction" method="{1}">
<result name="list">/WEB-INF/jsp/forumManageAction/list.jsp</result>
<result name="addUI">/WEB-INF/jsp/forumManageAction/saveUI.jsp</result>
<result name="editUI">/WEB-INF/jsp/forumManageAction/saveUI.jsp</result>
<result name="tolist"  type="redirectAction">forumManageAction_list</result>
</action>



<!--论坛:action 版块 -->
<action name="forumAction_*" class="forumAction" method="{1}">
<result name="list">/WEB-INF/jsp/forumAction/list.jsp</result>
<result name="show">/WEB-INF/jsp/forumAction/show.jsp</result>
</action>


<!--论坛:action 主题 -->
<action name="topicAction_*" class="topicAction" method="{1}">
<result name="show">/WEB-INF/jsp/topicAction/show.jsp</result>
<result name="addUI">/WEB-INF/jsp/topicAction/addUI.jsp</result>
<result name="toshow" type="redirectAction">topicAction_show?id=${id}</result>
                                            <!-- id:为主题的编号,从提交的model中获得其值-->
</action>

<!--论坛:action 回复 -->
<action name="replyAction_*" class="replyAction" method="{1}">
<result name="addUI">/WEB-INF/jsp/replyAction/addUI.jsp</result>
<result name="toTopicShow" type="redirectAction">topicAction_show?id=${topicId}</result>
</action>

<!--流程定义管理 -->
<!--下载图片-->
<action name="processDefinitionAction_*" class="processDefinitionAction" method="{1}">
<result name="list">/WEB-INF/jsp/processDefinitionAction/list.jsp</result>
<result name="addUI">/WEB-INF/jsp/processDefinitionAction/addUI.jsp</result>
<result name="toList"  type="redirectAction">processDefinitionAction_list</result>
    <result name="show" type="stream">
       <param name="InputName">download</param>
    </result>
</action>
</package>
</struts>



jdbc.properties配置文件

jdbcUrl = jdbc:mysql://localhost:3306/myoa
driverClass = com.mysql.jdbc.Driver
username = root
password =root


在 applicationContext.xml配置文件对应以下
<property name="jdbcUrl" value="${jdbcUrl}"></property>
<property name="driverClass" value="${driverClass}"></property>
<property name="user" value="${username}"> </property>
<property name="password" value="${password}"></property>





logging.properties配置文件


handlers= java.util.logging.ConsoleHandler
redirect.commons.logging = enabled

java.util.logging.ConsoleHandler.level =WARNING
java.util.logging.ConsoleHandler.formatter = org.jbpm.internal.log.LogFormatter

#org.jbpm.level=FINE
# org.jbpm.pvm.internal.tx.level=FINE
# org.jbpm.pvm.internal.wire.level=FINE
# org.jbpm.pvm.internal.util.level=FINE

#org.hibernate.level=INFO
#org.hibernate.cfg.SettingsFactory.level=SEVERE
#org.hibernate.cfg.HbmBinder.level=SEVERE
#org.hibernate.SQL.level=FINEST
#org.hibernate.type.level=FINEST
# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
# org.hibernate.transaction.level=FINEST

  相关解决方案