`

maven2创建ssh WEB工程

阅读更多

mvn archetype:create -DgroupId=com.actioner.ssh2 -DartifactId=ssh2 -DarchetypeArtifactId=maven-archetype-webapp

会创建一个叫ssh2的maven web工程。
手动补足test及其下的java resources filters等及main下的java目录

mvn -Declipse.workspace=d:\projects eclipse:add-maven-repo

mvn eclipse:eclipse


在eclipse中配置配置好tomcat,并将ssh2.xml文件放到tocmat的conf\catalian\localhost下.ssh2.xml内容如下:
<Context path="/ssh2" docBase="D:\projects\ssh2\target\ssh2" debug="0" privileged="true" reloadable="false" workDir="D:\projects\ssh2\target\ssh2\tmp"></Context>

在eclipse中导入ssh2工程

启动tomcat.在ie中输入url:http://localhost:8080/ssh2
如果出现“Hello World”
则OK!!

继续:
在pom.xml中增加对hibernate3.25.ga spring2.06 struts2.09-core包的依赖。可借助eclipse插件实现

在web.xml中增加struts2框架,并在src\main\resources中增加struts.xml 可以将appfuse项目中的copy过来做为模板
在web.xml中增加spring框架,并在src\main\resources中增加 ApplicationResources.properties ApplicationResources_zh_CN.properties log4j.xml 等资源文件。均可以将appfuse项目中的copy过来做为模板

applicationContext.xml必须放在src\main\webapp\web-inf下

在applicationContext.xml中一定要设置dataSource和sessionFactory否则会报错。mysql数据库和数据库连接池的依赖包也要加载到pom.xml中

Cannot locate the chosen ObjectFactory implementation: spring 要加载struts2-spring.plugs.jar到pom.xml

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics