簡易代碼之家
BlogJava
::
首頁
::
聯(lián)系
::
聚合
::
管理
157 Posts :: 2 Stories :: 57 Comments :: 0 Trackbacks
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(2)
給我留言
查看公開留言
查看私人留言
我參與的團隊
隨筆檔案
2015年6月 (1)
2015年4月 (5)
2015年3月 (2)
2015年1月 (3)
2014年12月 (2)
2014年11月 (3)
2014年10月 (4)
2014年9月 (4)
2014年8月 (5)
2014年7月 (11)
2014年6月 (1)
2014年4月 (1)
2013年11月 (1)
2013年8月 (1)
2013年7月 (4)
2013年6月 (1)
2013年5月 (6)
2013年4月 (3)
2013年3月 (2)
2013年2月 (2)
2013年1月 (1)
2012年10月 (3)
2012年9月 (10)
2012年8月 (3)
2012年7月 (2)
2012年6月 (1)
2012年4月 (4)
2011年4月 (1)
2011年3月 (1)
2011年2月 (2)
2010年12月 (2)
2010年10月 (1)
2010年9月 (1)
2010年8月 (2)
2010年7月 (1)
2010年6月 (5)
2010年5月 (9)
2010年3月 (1)
2010年1月 (2)
2009年11月 (1)
2009年9月 (5)
2009年5月 (4)
2009年4月 (7)
2008年10月 (3)
2008年8月 (1)
2008年7月 (5)
2008年6月 (2)
2008年5月 (1)
2008年4月 (3)
2008年3月 (6)
2008年1月 (3)
2007年12月 (1)
2007年11月 (1)
文章檔案
2012年10月 (1)
2007年11月 (1)
搜索
最新評論
1.?re: TFS新建根目錄文件夾
第三方
--手動閥
2.?re: Java web程序中備份oracle數據庫
要是寫上如何恢復數據庫就更好了
--yanwushu
3.?re: 一個調用百度地圖小實例[未登錄]
, .fj
--k
4.?re: Javascript實現(xiàn)Html頁面指定區(qū)域導出WORD
dsf
--d
5.?re: 移除JSCharts水印
fs.bg.2v(fX) 很棒
--zzz
閱讀排行榜
1.?Resource is out of sync with the file system的解決辦法(40110)
2.?巧用Ajax4Jsf的oncomplete事件(7153)
3.?一個調用百度地圖小實例(6635)
4.?集合的常用操作類CollectionUtils(5881)
5.?【百度地圖API】獲取行政區(qū)域的邊界(4631)
評論排行榜
1.?Resource is out of sync with the file system的解決辦法(8)
2.?Java中對日期的常用處理(6)
3.?實現(xiàn)文字上標的CSS樣式(4)
4.?Spring Mail中文亂碼問題(4)
5.?移除JSCharts水印(4)
Struts+Spring+Hibernate精簡配制文件
1.web.xml
<?
xml version="1.0" encoding="UTF-8"
?>
<
web-app
xmlns
="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
version
="2.4"
xsi:schemaLocation
="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>
<
context-param
>
<
param-name
>
contextConfigLocation
</
param-name
>
<
param-value
>
/WEB-INF/applicationContext*.xml
</
param-value
>
</
context-param
>
<
listener
>
<
listener-class
>
org.springframework.web.context.ContextLoaderListener
</
listener-class
>
</
listener
>
<
servlet
>
<
servlet-name
>
action
</
servlet-name
>
<
servlet-class
>
org.apache.struts.action.ActionServlet
</
servlet-class
>
<
init-param
>
<
param-name
>
config
</
param-name
>
<
param-value
>
/WEB-INF/struts-config.xml,/WEB-INF/struts-config-form.xml,/WEB-INF/struts-config-action.xml
</
param-value
>
</
init-param
>
<
init-param
>
<
param-name
>
debug
</
param-name
>
<
param-value
>
3
</
param-value
>
</
init-param
>
<
init-param
>
<
param-name
>
detail
</
param-name
>
<
param-value
>
3
</
param-value
>
</
init-param
>
<
load-on-startup
>
0
</
load-on-startup
>
</
servlet
>
<
servlet-mapping
>
<
servlet-name
>
action
</
servlet-name
>
<
url-pattern
>
*.do
</
url-pattern
>
</
servlet-mapping
>
<
session-config
>
<
session-timeout
>
120
</
session-timeout
>
</
session-config
>
<!--
The Usual Welcome File List
-->
<
welcome-file-list
>
<
welcome-file
>
login.jsp
</
welcome-file
>
</
welcome-file-list
>
<!--
Tag Library Descriptors
-->
<
jsp-config
>
<
taglib
>
<
taglib-uri
>
/WEB-INF/tld/struts-bean.tld
</
taglib-uri
>
<
taglib-location
>
/WEB-INF/tld/struts-bean.tld
</
taglib-location
>
</
taglib
>
<
taglib
>
<
taglib-uri
>
/WEB-INF/tld/struts-html.tld
</
taglib-uri
>
<
taglib-location
>
/WEB-INF/tld/struts-html.tld
</
taglib-location
>
</
taglib
>
<
taglib
>
<
taglib-uri
>
/WEB-INF/tld/struts-logic.tld
</
taglib-uri
>
<
taglib-location
>
/WEB-INF/tld/struts-logic.tld
</
taglib-location
>
</
taglib
>
<
taglib
>
<
taglib-uri
>
/WEB-INF/tld/struts-nested.tld
</
taglib-uri
>
<
taglib-location
>
/WEB-INF/tld/struts-nested.tld
</
taglib-location
>
</
taglib
>
<
taglib
>
<
taglib-uri
>
/WEB-INF/tld/struts-template.tld
</
taglib-uri
>
<
taglib-location
>
/WEB-INF/tld/struts-template.tld
</
taglib-location
>
</
taglib
>
<
taglib
>
<
taglib-uri
>
/WEB-INF/tld/struts-tiles.tld
</
taglib-uri
>
<
taglib-location
>
/WEB-INF/tld/struts-tiles.tld
</
taglib-location
>
</
taglib
>
</
jsp-config
>
</
web-app
>
2.applicationContext-persistence.xml
<?
xml version="1.0" encoding="UTF-8"
?>
<!
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd"
>
<
beans
>
<!--
配置數據源
-->
<
bean
id
="dataSource"
class
="org.apache.commons.dbcp.BasicDataSource"
destroy-method
="close"
>
<
property
name
="driverClassName"
>
<
value
>
oracle.jdbc.driver.OracleDriver
</
value
>
</
property
>
<
property
name
="url"
>
<
value
>
jdbc:oracle:thin:@localhost:1521:ora9i
</
value
>
</
property
>
<
property
name
="username"
>
<
value
>
tom
</
value
>
</
property
>
<
property
name
="password"
>
<
value
>
tom
</
value
>
</
property
>
</
bean
>
<!--
配置Hibernate
-->
<
bean
id
="sessionFactory"
class
="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
>
<
property
name
="dataSource"
>
<
ref
local
="dataSource"
/>
</
property
>
<
property
name
="mappingResources"
>
<
list
>
<
value
>
com/example/entity/User.hbm.xml
</
value
>
</
list
>
</
property
>
<
property
name
="hibernateProperties"
>
<
props
>
<
prop
key
="hibernate.dialect"
>
org.hibernate.dialect.Oracle9Dialect
</
prop
>
<
prop
key
="hibernate.show_sql"
>
true
</
prop
>
</
props
>
</
property
>
</
bean
>
<!--
配置事務
-->
<
bean
id
="transactionManager"
class
="org.springframework.orm.hibernate3.HibernateTransactionManager"
>
<
property
name
="sessionFactory"
>
<
ref
local
="sessionFactory"
/>
</
property
>
</
bean
>
<
bean
id
="transactionInterceptor"
class
="org.springframework.transaction.interceptor.TransactionInterceptor"
>
<
property
name
="transactionManager"
ref
="transactionManager"
/>
<
property
name
="transactionAttributes"
>
<
props
>
<
prop
key
="find*"
>
PROPAGATION_REQUIRED,readOnly
</
prop
>
<
prop
key
="save*"
>
PROPAGATION_REQUIRED
</
prop
>
<
prop
key
="update*"
>
PROPAGATION_REQUIRED
</
prop
>
<
prop
key
="delete*"
>
PROPAGATION_REQUIRED
</
prop
>
</
props
>
</
property
>
</
bean
>
<
bean
id
="transactionProxyCreator"
class
="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"
>
<
property
name
="proxyTargetClass"
>
<
value
>
true
</
value
>
</
property
>
<
property
name
="beanNames"
>
<
list
>
<
value
>
*Service
</
value
>
</
list
>
</
property
>
<
property
name
="interceptorNames"
>
<
list
>
<
value
>
transactionInterceptor
</
value
>
</
list
>
</
property
>
</
bean
>
</
beans
>
3.applicationContext-action.xml
<?
xml version="1.0" encoding="UTF-8"
?>
<!
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"
>
<
beans
>
<!--
example
-->
<
bean
name
="/login"
class
="com.example.actions.LoginAction"
>
<
property
name
="userService"
>
<
ref
bean
="userService"
/>
</
property
>
</
bean
>
</
beans
>
4.applicationContext-service.xml
<?
xml version="1.0" encoding="UTF-8"
?>
<!
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"
>
<
beans
>
<!--
example
-->
<
bean
id
="userService"
class
="com.example.service.UserService"
>
<
property
name
="userDAO"
>
<
ref
bean
="userDAO"
/>
</
property
>
</
bean
>
</
beans
>
5.applicationContext-dao.xml
<?
xml version="1.0" encoding="UTF-8"
?>
<!
DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"
>
<
beans
>
<!--
example
-->
<
bean
id
="userDAO"
class
="com.example.dao.UserDAO"
>
<
property
name
="sessionFactory"
>
<
ref
bean
="sessionFactory"
/>
</
property
>
</
bean
>
</
beans
>
6.struts-config.xml
<?
xml version="1.0" encoding="UTF-8"
?>
<!
DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"
>
<
struts-config
>
<!--
Global-Forwards
-->
<
global-forwards
>
<
forward
name
="login"
path
="/login.do"
/>
<
forward
name
="welcome"
path
="/welcome.do"
/>
</
global-forwards
>
<!--
Resources
-->
<
message-resources
parameter
="ApplicationResources"
/>
</
struts-config
>
7.struts-config-action.xml
<?
xml version="1.0" encoding="UTF-8"
?>
<!
DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"
>
<
struts-config
>
<
action-mappings
>
<!--
example
-->
<
action
path
="/login"
name
="loginForm"
scope
="request"
type
="org.springframework.web.struts.DelegatingActionProxy"
input
="/login.jsp"
>
<
forward
name
="success"
path
="/welcome.jsp"
/>
<
forward
name
="failure"
path
="/login.jsp"
/>
</
action
>
</
action-mappings
>
</
struts-config
>
8.struts-config-form.xml
<?
xml version="1.0" encoding="UTF-8"
?>
<!
DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"
>
<
struts-config
>
<
form-beans
>
<!--
example
-->
<
form-bean
name
="loginForm"
type
="com.example.forms.LoginForm"
>
</
form-bean
>
</
form-beans
>
</
struts-config
>
posted on 2009-04-23 10:46
Jakin.zhou
閱讀(1171)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Copyright @ Jakin.zhou
Powered by:
.Text
and
ASP.NET
Theme by:
.NET Monster
主站蜘蛛池模板:
博野县
|
阿拉善左旗
|
游戏
|
云霄县
|
龙山县
|
芦山县
|
菏泽市
|
清河县
|
衡阳县
|
北票市
|
洪江市
|
卢龙县
|
灵宝市
|
台北市
|
东海县
|
江孜县
|
新泰市
|
井研县
|
花莲市
|
娱乐
|
吐鲁番市
|
无锡市
|
商河县
|
郓城县
|
长丰县
|
左云县
|
通海县
|
邛崃市
|
蒙山县
|
通州市
|
故城县
|
毕节市
|
邵阳县
|
白山市
|
姚安县
|
北安市
|
双柏县
|
孟津县
|
绥阳县
|
吐鲁番市
|
东台市
|