| |
1、myeclipse下建立新的web porject
2、copy struts2的lib文件到工程的web-inf/lib下非*-plugin-2.0.6.jar的所有的包加上struts2-spring- plugin-2.0.6.jar,最小的包可以在struts-2.0.6/apps/struts2-blank-2.0.6/web-inf/ lib下找到,不过因为使用spring、hiberate那点包是不够用的
3.1、工程名上右键->myeclipse->add spring capabilities点击出现对话框
3.2、由于我用的myeclipse中spring的插件是1.2的,所以没使用myeclipse下的包,不选择myeclipse libraries
3.3、选中copy checked library contents to project folder (tlds always copied)
3.4、使用默认的library folder:/webroot/web-inf/lib,next
3.5、folder点周brower选中项目的webroot/web-inf/
3.6、点击finish
4、配置myeclipse数据库设置
4.1、菜单windows->preferences->myeclipse->database explorer->drivers
4.2、点击new设置数据库连接,例: driver template : oracle (thin driver) driver name : oracle (thin driver) connection url : jdbc:oracle:thin:@<server>[:<1521>]:<database_name> driver jars: ojdbc14.jar dirver classname : oracle.jdbc.driver.oracledriver
4.3、点击ok、ok
5、忘了copy spring 2的jar包到工程中了,不过没关系,现在copy也一样,copy spring-framework-2.0.3/dist/spring.jar 到/webroot/web-inf/lib下就可以了,如果想copy专用的包可以copy spring-framework-2.0.3/dist/modules下的
5.1、菜单windows->open perspective->myeclipse database explorer
5.2、在db brower点右键->new
5.3、配置例子如下: profile name: test driver: oracle (thin driver) url: jdbc:oracle:thin:@127.0.0.1:1521:test user name: test password: test 选中save password
5.4、点击finish
6.1、配置hibernate
6.2 工程名上右键->myeclipse->add hiberate capabilities点击出现对话框
6.3、选中copy checked library jars to project forlder and add to build-path 点击next
6.4、选中spring configuration file (applicationcontext.xml)点击next
6.5、选中existing spring configuration file,myeclipse会帮你自动找到spring config文件的
6.6、sessionfactory id填写sessionfactory点击next
6.7、bean id填写datasource,选中db profile下刚才建好的test,点击next
6.8、不选择create sessionfactory class?点击finish
7、这时候会提示你某些类没发现,copy commons-dbcp-1.2.1.jar到lib下就ok了
|
|