闵毓
http://www.eshoo.com.cn 欢迎来到异客中国
posts - 49,comments - 97,trackbacks - 0

Myeclipse开发struts+hibernate+spring小记

开发前准备工作:

1、下载eclipse3.1版本

      下载地址:

2、下载Myeclipse插件

      下载地址:

3、根据需要下载所需要的数据库驱动。

      部分下载地址:

4、下载的eclipse3.1进行解压缩。安装Myeclipse,分为手工安装和自动安装两种安装方法。

       具体安装方法如下:

       手工安装:

       自动安装:

5、安装完成后。启动Myeclipse

准备开发工作:

步骤:

1、新建项目:

      New>projects后进入下图

本文主要介绍开发Web Project项目,因此需要选择Web Project,下一步,进入下图:

a.JPG
Project Name
:为需要建立的项目名称。填写好项目名称后,Finish。新建项目完成。本文在项目命名为test.

项目建立完成之后,在Myeclipse视图中,Package Explorer中显示如下:

b.JPGtest:为项目名称。

Src:为源文件所放路径。

WebRoot:为Web root folder

 

 

 

 

 

 




2
、加载Struts

   在所建立项目test上右键后,提示如下页面:

c.JPG

  在弹出的菜单中,根据图例提示,选择
Myeclipse后在弹出的二级菜单中选择Add Struts Capabilities…后提示如下图所示:

d.JPG
在弹出的对话框中,设置如下:

Struts config path:默认,一般不需要改变。

Struts specification:选择Struts版本,在此项目中,选择Struts 1.2版本。

Base Package for new classes:设置为空。

取消Install Struts TLDs选项。

其他默认:

Finish.后在Package ExplorerLib包如下:

e.JPG
到此,加载
Struts完成。在此需要关注Struts-config.xml文件。

3、加载hibernate:

同加载struts方式类似,选择Myeclipse后在弹出的二级菜单中选择Add Hibernate Capabilities…后提示如下图所示:

f.JPG
可以根据提示,选择
Hibernate Specification:本项目选择Hibernate3,其他默认,Next>

默认后直接下一步。在此可以去掉Configuration File Name中的内容。Next>
h.JPG

后去掉下一级页面的
Create SessionFactory class选项。然后FinishFinish完成后,在Lib目录下会提示相关的jar包。

4、加载spring in action in action

同加载struts方式类似,选择Myeclipse后在弹出的二级菜单中选择Add spring in action in action Capabilities…后提示如下图所示:

g.JPG

选择所需要的
spring in action in action包,然后默认下一步,直到完成。

到此,Struts+hibernate+spring配置完成。

附加:在项目名称的右键后进入Properties然后进入Java Build Path后查看加载的jar包。

具体项目的开发详细文档请见下一篇文章《struts+hibernate+spring项目开发示例》

posted on 2005-11-05 01:30 闵毓 阅读(25583) 评论(25)  编辑  收藏

FeedBack:
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2005-11-10 16:10 | 黄剑
很好,很实用,也没有抄袭之嫌。
up  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2005-11-15 23:17 | 小草
不错!不过我配置的时候,老是不能把那些导入的包自动放到webroot的lib文件夹里,能把具体设置放出来吗?  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2005-11-16 09:15 | 闵毓
如果你在自动建立项目的过程中,不能把lib下的jar包自动放到WebRoot下的lib下的话,我建议你手工放置,具体方法:右键你所建立的项目,打开properties(首选项)后,再进入Java Build Path下的Libraries中进行添加本地jar包.如果你的Libraries下已经存在Jar包,那么你可以在Myeclipse视图下,进行查看你是否过滤显示.jar包.  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2005-11-16 15:35 | 小草
很高兴见到回复,我的意思是在Add Struts Capabilities之后,可以把它所需的包放到webroot的lib里,这样看起来就比较干净,看到你的也是这样.我后来做到了,但在自动建action类的时候,提示说找不到action的父类.你怎么设置可以使项目能引用到webroot的lib的包的类  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2005-11-16 15:58 | 小草
用了一年的eclipse,但使用它的时间少得很,因为都浪费在配置上了,碰到了问题,有时候很久都不能解决,很希望有个人能给点建议或谈论下,我QQ是285042783,能交个朋友吗?  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2005-11-24 14:26 | tj
我以前是用JBuilder2005,现在在用Myeclipse就是有时候碰到问题不知道问谁
我QQ是84745181,想和你交个朋友,可以吗?  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2005-11-30 10:37 | blackstoneh
一直在找这样的文章,清晰明了,对于我这个对配置环境一巧不通的人太合适了^_^  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2006-02-20 11:25 | sxs
在加载hibernate时,去掉Configuration File Name中的内容后,next按钮就变灰不能用了,我的是eclipse 3.1.0,myeclipse4.0.0,不知道楼主与各位是怎么办的?
只能生成hibernate配置文件,然后手动删除?  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2006-02-20 12:16 | shmily
加载struts、hibernate、spring时的顺序有关。正确的加载顺序应该下加载spring,然后是hibernate。希望对你有用。  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2006-05-14 11:49 | lion
讲得还是不够详细  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2006-05-29 15:49 | www
@闵毓
@小草
你是怎么把struts那些包放到lib下面的?????
我是一个新手,能详细点吗?非常感谢。  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2006-06-26 05:39 | Koki
你好我是一个新手,请问在你的配置中为什么"取消Install Struts TLDs选项。"这么设置,这个不是标签库吗?
等待你的回答,谢谢!  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2006-07-07 10:06 | 谷岩
结交JAVA好友,我的Q:153381145  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2006-07-07 11:16 | JONSON
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.jonson.Test.main(Test.java:10)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at net.sf.hibernate.cfg.Configuration.<clinit>(Configuration.java:95)
... 1 more
Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
... 5 more
Caused by: java.lang.NullPointerException
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374)
... 6 more


我的HIBERNATE配置完运行出现了现在的这个问题,请帮忙解决。  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2006-08-10 09:57 | 邓海通
还有一个问题就是这样生成后spring的action-servlet.xml和applicationContext.xml都不会自动生成要自己手动加入进去的,我的myeclipse是这样的,不知道大家的是不是???????  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2006-09-26 16:42 | 过客008
很清晰,我问一个问题,我原来的项目在Jbuilder下开发的,现在想倒到eclipse下,怎么倒,请多指教  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2006-09-27 11:22 | 闵毓
我几乎没怎么用过JB,所以我也不是很清楚,但我个人意见是,在eclipse新建一个项目,根据eclipse的文件部署,相对应的拷贝、粘贴就可以,而且不会出问题,同时也很简单。但如果必须要直接导的话,可能会新建eclipse新项目的配置文件,然后通过import,找到项目所在目录,即可导入。  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2006-10-20 16:17 | Dreamer[匿名]
屁!顺序根本不对!  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2006-10-20 16:40 | 闵毓[匿名]
抱歉,请指教。  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2006-11-22 14:19 | leifeng
不错,加油  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2007-01-03 13:02 | XX
@blackstoneh
晕死  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置[未登录]
2007-02-05 22:46 | 闵毓
谢谢批评,虚心接受.
只是我的博客是用来记录我工作中的点点滴滴.我不是写手,敬请谅解.  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2007-04-26 16:58 | qsh
hibernate 加载好像不对,Configuration File Name中的内容不能少,Create SessionFactory class选项 好像也没有  回复  更多评论
  
# re: Myeclipse开发struts+hibernate+spring新手入门---环境配置
2007-05-28 15:24 | yeqiang
this is very good  回复  更多评论