s2sh开发环境配置文档.docx

上传人:b****6 文档编号:9041813 上传时间:2023-02-02 格式:DOCX 页数:17 大小:609.79KB
下载 相关 举报
s2sh开发环境配置文档.docx_第1页
第1页 / 共17页
s2sh开发环境配置文档.docx_第2页
第2页 / 共17页
s2sh开发环境配置文档.docx_第3页
第3页 / 共17页
s2sh开发环境配置文档.docx_第4页
第4页 / 共17页
s2sh开发环境配置文档.docx_第5页
第5页 / 共17页
点击查看更多>>
下载资源
资源描述

s2sh开发环境配置文档.docx

《s2sh开发环境配置文档.docx》由会员分享,可在线阅读,更多相关《s2sh开发环境配置文档.docx(17页珍藏版)》请在冰豆网上搜索。

s2sh开发环境配置文档.docx

s2sh开发环境配置文档

XXXX系统开发环境配置

Struts2.0.14+Spring2.5+Hibernate3.2+Oracle10g+Tomcat6.0

+web.xml+applicationContext.xml文件配置

 

版本

作者

日期

备注

V1.0.0

2009-9-01

提出原始版本,分发各相关人员。

教学管理系统开发环境配置0

1配置Oracle10g3

2配置Spring7

3配置Hibernate12

4配置Struts2.0.1417

5配置JDK19

6配置Tomcat22

配置Oracle10g

1先安装好Oracle10g,在MyEclipse6.5中配置数据库,在右上角选择MyEclipseDatabase.

2创建数据连接

3配置数据文件

4点击next

5点击finish

6双击新建数据连接进行测试

7打开MyEclipse6.5,新建WebProject(OptioanalMovenSupport)

8输入项目名称,点击finish。

配置Spring

1配置Spring2.5

2配置Spring2.5的JAR包(共计5个)

3点击next,在这个界面中我们要手动选择Spring配置文件放置的地方,如图

4点击finish

配置Hibernate

1配置Hibernate3.2

2添加JAR包(三个全选)

3点击next

4选择SpringConfigurationfile

5点击next

6在下图中要做出修改,选择ExistingSpringconfigurationfile

7在SessionFactoryID:

填写sessionFactory

8点击next

9在下图中配置数据连接

10点击next

11在下图中,不要选择createSeeionFactoryclass

12点击finish

 

配置Struts2.0.14

1复制Struts2.0.14的五个JAR包(要特别注意struts2-spring-plugin-2.0.14)

2复制到工程目录下WEB-INF/lib/中(右键Paste)

3在src目录下,建立四个包,名字分别为po,action,dao,service和struts.xml文件

4将以下代码加入

xmlversion="1.0"encoding="UTF-8"?

>

--Struts2的Action必须放在指定的包空间下定义-->

--伪action它的class必须与applicationContext.xml中service注入action配置时的beanid一致-->

--定义处理结果和资源之间映射关系。

-->

/login.jsp

/error.jsp

/welcome.jsp

配置JDK

1配置Tomcat6.0.18,点击window-->选择Perference

2先进行JDK的配置,选择InstalledJREs

3点击右侧Add选项,出现添加JDK窗口。

4点击Browse添加本机JDK。

效果如下

5点击OK。

出现下图

6点击OK。

配置Tomcat

1配置Tomcat6.0.18

Tomcat6.0.18,点击window-->选择Perference

2先进行JDK的配置,选择MyEclipseEnterpriseWorkbench-->Servers-->Tomcat。

出现下图。

3选择ConfigureTomcat6.x

4添加本地Tomcat

5选择Enable。

点击Browse添加本机Tomcat地址。

如下图

6点击OK。

配置结束。

----------------------------------------------------------------Web.xml配置文件

xmlversion="1.0"encoding="UTF-8"?

>

xmlns:

xsi="http:

//www.w3.org/2001/XMLSchema-instance"

xsi:

schemaLocation="

--配置spring的监听器-->

contextConfigLocation

/WEB-INF/applicationContext.xml,

/WEB-INF/spring-config/spring_dao.xml

--开启监听-->

org.springframework.web.context.ContextLoaderListener

--

配置OpenSessionInViewFilter,必须在struts2监听之前,用来解决couldnotinitialize

proxy-noSession报错问题,配置自己写的filter

-->

lazyLoadingFilter

org.springframework.orm.hibernate3.support.OurOpenSessionInViewFilter

lazyLoadingFilter

*.action

--设置监听加载上下文-->

struts2

org.apache.struts2.dispatcher.FilterDispatcher

struts2

/*

--

设置访问资源,能访问web-inf下的jsp页面test

/WEB-INF/ui/jsp/globle/main.jsp

test

/test.jsp

-->

/WEB-INF/ui/jsp/globle/main.jsp

--------------------------------------------------------------------applicationContext.xml配置文件

xmlversion="1.0"encoding="UTF-8"?

>

//www.springframework.org/schema/beans"

xmlns:

xsi="http:

//www.w3.org/2001/XMLSchema-instance"xmlns:

aop="http:

//www.springframework.org/schema/aop"

xmlns:

tx="http:

//www.springframework.org/schema/tx"

xsi:

schemaLocation="http:

//www.springframework.org/schema/beanshttp:

//www.springframework.org/schema/beans/spring-beans-2.5.xsd

http:

//www.springframework.org/schema/tx

http:

//www.springframework.org/schema/tx/spring-tx.xsd

http:

//www.springframework.org/schema/aop

http:

//www.springframework.org/schema/aop/spring-aop.xsd">

--

解决:

Writeoperationsarenotallowedinread-onlymode

(FlushMode.NEVER/MANUAL):

TurnyourSessionintoFlushMode.COMMIT/AUTO

orremove'readOnly'markerfromtransactiondefinition.

-->

class="org.springframework.orm.hibernate3.HibernateTransactionManager">

--配置Advice(事务的传播特性)-->

adviceid="txAdvice"transaction-manager="transactionManager">

attributes>

methodname="add*"propagation="REQUIRED"/>

methodname="del*"propagation="REQUIRED"/>

methodname="update*"propagation="REQUIRED"/>

methodname="get*"propagation="SUPPORTS"/>

methodname="search*"propagation="SUPPORTS"/>

methodname="show*"propagation="SUPPORTS"/>

attributes>

advice>

--配置事务管理器应用的范围-->

config>

pointcutid="affectMethods"

expression="execution(*lk.edu.tms.*.*(..))"/>

advisoradvice-ref="txAdvice"pointcut-ref="affectMethods"/>

config>

/////配置注入:

service<-DAO,可以多个dao注入同一个service

--dao注入service,class是service实现类,ref的UserDAO也是实现类-->

/////配置注入:

Action<-service

--struts2整合spring时:

service注入action中的beanid要与struts.xml配置文件中的actionclass一致-->

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 农林牧渔 > 畜牧兽医

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1