日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

SSH的各个配置文件:

發布時間:2025/4/5 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SSH的各个配置文件: 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

struts的配置:

struts.xml:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts SYSTEM "http://struts.apache.org/dtds/struts-2.1.7.dtd" PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN">

-<struts>

<!-- 配置action的訪問路徑為.do的形式 -->


<constant value="do" name="struts.action.extension"/>

<!-- 配置struts的開發模式 -->


<constant value="true" name="struts.devMode"/>

<!-- 配置struts的簡單模式 -->


<constant value="simple" name="struts.ui.theme"/>


-<package name="system" extends="struts-default" namespace="/system">

<!-- 首頁登錄 -->

?

-<action name="elecMenuAction_*" method="{1}" class="cn.itcast.elec.web.action.ElecMenuAction">

<result name="home"> /WEB-INF/page/menu/home.jsp </result>

<!-- 處理驗證登錄失敗,跳轉到index.jsp -->


<result name="error"> /WEB-INF/page/menu/index.jsp </result>

<result name="title"> /WEB-INF/page/menu/title.jsp </result>

<result name="left"> /WEB-INF/page/menu/left.jsp </result>

<result name="change1"> /WEB-INF/page/menu/change1.jsp </result>

<result name="loading"> /WEB-INF/page/menu/loading.jsp </result>

<result name="alermJX"> /WEB-INF/page/menu/alermJX.jsp </result>

<result name="alermSB"> /WEB-INF/page/menu/alermSB.jsp </result>

<result name="alermXZ"> /WEB-INF/page/menu/alermXZ.jsp </result>

<result name="alermYS"> /WEB-INF/page/menu/alermYS.jsp </result>

<result name="alermZD"> /WEB-INF/page/menu/alermZD.jsp </result>

<result name="logout"> /WEB-INF/page/menu/index.jsp </result>

</action>

<!-- 代辦事宜 -->

?

-<action name="elecCommonMsgAction_*" method="{1}" class="cn.itcast.elec.web.action.ElecCommonMsgAction">

<result name="home"> /WEB-INF/page/system/actingIndex.jsp </result>


-<result name="save" type="redirectAction">

<param name="actionName">elecCommonMsgAction_home</param>

<param name="namespace">/system</param>

</result>

</action>

<!-- 數據字典 -->

?

-<action name="elecSystemDDlAction_*" method="{1}" class="cn.itcast.elec.web.action.ElecSystemDDlAction">

<result name="home"> /WEB-INF/page/system/dictionaryIndex.jsp </result>

<result name="edit"> /WEB-INF/page/system/dictionaryEdit.jsp </result>


-<result name="save" type="redirectAction">

<param name="actionName">elecSystemDDlAction_home</param>

<param name="namespace">/system</param>

</result>

</action>

<!-- 用戶管理 -->

?

-<action name="elecUserAction_*" method="{1}" class="cn.itcast.elec.web.action.ElecUserAction">

<result name="home"> /WEB-INF/page/system/userIndex.jsp </result>

<!-- 2011-12-31日修改,添加分頁功能 -->


<result name="userlist"> /WEB-INF/page/system/userList.jsp </result>

<!-- 2011-12-31日修改,使用poi報表導出excel的數據 -->


<result name="export"> /WEB-INF/page/system/userIndex.jsp </result>

<!-- 2011-13-31日修改,使用jxl從excel中獲取數據,導入到數據庫中 -->


<result name="importpage"> /WEB-INF/page/system/userImport.jsp </result>

<result name="importdata"> /WEB-INF/page/system/userImport.jsp </result>

<!-- 2012-1-2日修改,使用Jfreechart報表統計人員 -->


<result name="chart"> /WEB-INF/page/system/userReport.jsp </result>

<result name="add"> /WEB-INF/page/system/userAdd.jsp </result>

<result name="edit"> /WEB-INF/page/system/userEdit.jsp </result>


-<result name="list" type="redirectAction">

<param name="actionName">elecUserAction_home</param>

<param name="namespace">/system</param>

</result>

</action>

<!-- 角色管理 -->

?

-<action name="elecRoleAction_*" method="{1}" class="cn.itcast.elec.web.action.ElecRoleAction">

<result name="home"> /WEB-INF/page/system/roleIndex.jsp </result>

<result name="edit"> /WEB-INF/page/system/roleEdit.jsp </result>


-<result name="save" type="redirectAction">

<param name="actionName">elecRoleAction_home</param>

<param name="namespace">/system</param>

</result>

</action>

<!-- 日志管理 -->

?

-<action name="elecLogAction_*" method="{1}" class="cn.itcast.elec.web.action.ElecLogAction">

<result name="home"> /WEB-INF/page/system/logIndex.jsp </result>


-<result name="delete" type="redirectAction">

<param name="actionName">elecLogAction_home</param>

<param name="namespace">/system</param>

</result>

</action>


-<action name="elecTextAction_*" method="{1}" class="cn.itcast.elec.web.action.ElecTextAction">

<result name="save"> /system/textAdd.jsp </result>

</action>

</package>

</struts>

hibernate的配置:

hibernate.cfg.xml:

?

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-configuration SYSTEM "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN">

-<hibernate-configuration>


-<session-factory>

<!-- <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password">root</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/itcast1222elec</property> <property name="hibernate.connection.autocommit">true</property> -->


<property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>

<property name="hibernate.hbm2ddl.auto">update</property>

<property name="hibernate.show_sql">true</property>

<mapping resource="cn/itcast/elec/domain/ElecText.hbm.xml"/>

<mapping resource="cn/itcast/elec/domain/ElecCommonMsg.hbm.xml"/>

<mapping resource="cn/itcast/elec/domain/ElecSystemDDl.hbm.xml"/>

<mapping resource="cn/itcast/elec/domain/ElecUser.hbm.xml"/>

<mapping resource="cn/itcast/elec/domain/ElecUserRole.hbm.xml"/>

<mapping resource="cn/itcast/elec/domain/ElecRolePopedom.hbm.xml"/>

<mapping resource="cn/itcast/elec/domain/ElecLog.hbm.xml"/>

</session-factory>

</hibernate-configuration>

spring的配置:

bean.xml:

<?xml version="1.0" encoding="UTF-8"?>

-<beans 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 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns="http://www.springframework.org/schema/beans">

<!-- 1:配置注解的自動掃描的范圍 -->


<context:component-scan base-package="cn.itcast.elec"/>

<!-- 2:配置數據源 -->

db.properties:

跟之前的配置是一樣的:

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/數據庫名?characterEncoding=utf-8
jdbc.username=用戶名
jdbc.password=用戶密碼

?

-<bean destroy-method="close" class="com.mchange.v2.c3p0.ComboPooledDataSource" id="dataSource">

<property value="com.mysql.jdbc.Driver" name="driverClass"/>

<property value="jdbc:mysql://localhost:3306/itcast1222elec?useUnicode=true&characterEncoding=UTF-8" name="jdbcUrl"/>

<property value="root" name="user"/>

<property value="root" name="password"/>

<!--連接池中保留的最小連接數。-->


<property value="5" name="minPoolSize"/>

<!--連接池中保留的最大連接數。Default: 15 -->


<property value="30" name="maxPoolSize"/>

<!--初始化時獲取的連接數,取值應在minPoolSize與maxPoolSize之間。Default: 3 -->


<property value="10" name="initialPoolSize"/>

<!--最大空閑時間,60秒內未使用則連接被丟棄。若為0則永不丟棄。Default: 0 -->


<property value="60" name="maxIdleTime"/>

<!--當連接池中的連接耗盡的時候c3p0一次同時獲取的連接數。Default: 3 -->


<property value="5" name="acquireIncrement"/>

<!--JDBC的標準參數,用以控制數據源內加載的PreparedStatements數量。但由于預緩存的statements 屬于單個connection而不是整個連接池。所以設置這個參數需要考慮到多方面的因素。 如果maxStatements與maxStatementsPerConnection均為0,則緩存被關閉。Default: 0-->


<property value="0" name="maxStatements"/>

<!--每60秒檢查所有連接池中的空閑連接。Default: 0 -->


<property value="60" name="idleConnectionTestPeriod"/>

<!--定義在從數據庫獲取新連接失敗后重復嘗試的次數。Default: 30 -->


<property value="30" name="acquireRetryAttempts"/>

<!--獲取連接失敗將會引起所有等待連接池來獲取連接的線程拋出異常。但是數據源仍有效 保留,并在下次調用getConnection()的時候繼續嘗試獲取連接。如果設為true,那么在嘗試 獲取連接失敗后該數據源將申明已斷開并永久關閉。Default: false-->


<property value="true" name="breakAfterAcquireFailure"/>

</bean>

<!-- 3:創建sessionFactory,這是spring整合hibernate的入口 -->

?

-<bean class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" id="sessionFactory">

<property name="dataSource" ref="dataSource"/>


-<property name="configLocation">

<value> classpath:hibernate.cfg.xml </value>

</property>

</bean>

<!-- 4:創建事務管理器 -->

?

-<bean class="org.springframework.orm.hibernate3.HibernateTransactionManager" id="txManage">

<property name="sessionFactory" ref="sessionFactory"/>

</bean>

<!-- 5:以注解的形式管理事務 -->


<tx:annotation-driven transaction-manager="txManage"/>

</beans>

?

總結

以上是生活随笔為你收集整理的SSH的各个配置文件:的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。