`
onlysomeone
  • 浏览: 144148 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

如何创建集成SSH项目的maven项目——提供pom文件

阅读更多
如何创建集成SSH项目的maven项目——提供pom文件
个人琢磨了几天的原创,未经同意请勿转载。
不同网上搜索的方式,本方法导入eclipse、myeclipse、等IDE工具可以直接使用。
 
一、创建如下目录结构
\src\main\java
\src\main\resources
\src\main\webapp\WEB-INF
\src\test\java
\src\test\resources
二、在\src\main\webapp\WEB-INF中创建如下文件
web.xml
struts.xml
applicationContext.xml
hibernate.cfg.xml
 
三、创建pom文件(重点)
内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
 
<context-param>
<param-name>contextConfigLocation</param-name>
<!-- <param-value>classpath:applicationContext.xml</param-value> -->
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
 
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
 
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>config</param-name>
    <param-value>struts-default.xml,struts-plugin.xml,../../WEB-INF/struts.xml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
 
<filter>
<filter-name>encoding</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
 
 
<filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>OpenSessionInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
 
</web-app>
 
四、在eclipse或myeclipse等IDE工具导入maven项目
 

 

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics