---
title: "如何创建集成SSH项目的maven项目——提供pom文件"
author: "onlysomeone"
date: "2016-11-23T10:37:42Z"
tags: []
categories: ["企业架构"]
slug: "ssh-maven-pom"
draft: false
lastmod: "2016-11-23T10:37:42Z"
id: 2339945
url: "https://onlysomeone.iteye.com/blog/2339945"
---

如何创建集成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文件（重点）

内容如下：

&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;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"&gt;

 

&lt;context-param&gt;

&lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;

&lt;!-- &lt;param-value&gt;classpath:applicationContext.xml&lt;/param-value&gt; --&gt;

&lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;

&lt;/context-param&gt;

 

&lt;listener&gt;

&lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;

&lt;/listener&gt;

 

&lt;filter&gt;

&lt;filter-name&gt;struts2&lt;/filter-name&gt;

&lt;filter-class&gt;org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter&lt;/filter-class&gt;

&lt;init-param&gt;

&lt;param-name&gt;config&lt;/param-name&gt;

    &lt;param-value&gt;struts-default.xml,struts-plugin.xml,../../WEB-INF/struts.xml&lt;/param-value&gt;

&lt;/init-param&gt;

&lt;/filter&gt;

&lt;filter-mapping&gt;

&lt;filter-name&gt;struts2&lt;/filter-name&gt;

&lt;url-pattern&gt;/\*&lt;/url-pattern&gt;

&lt;/filter-mapping&gt;

 

&lt;filter&gt;

&lt;filter-name&gt;encoding&lt;/filter-name&gt;

&lt;filter-class&gt;org.springframework.web.filter.CharacterEncodingFilter&lt;/filter-class&gt;

&lt;init-param&gt;

&lt;param-name&gt;encoding&lt;/param-name&gt;

&lt;param-value&gt;UTF-8&lt;/param-value&gt;

&lt;/init-param&gt;

&lt;/filter&gt;

&lt;filter-mapping&gt;

&lt;filter-name&gt;encoding&lt;/filter-name&gt;

&lt;url-pattern&gt;/\*&lt;/url-pattern&gt;

&lt;/filter-mapping&gt;

 

 

&lt;filter&gt;

&lt;filter-name&gt;OpenSessionInViewFilter&lt;/filter-name&gt;

&lt;filter-class&gt;org.springframework.orm.hibernate3.support.OpenSessionInViewFilter&lt;/filter-class&gt;

&lt;/filter&gt;

&lt;filter-mapping&gt;

&lt;filter-name&gt;OpenSessionInViewFilter&lt;/filter-name&gt;

&lt;url-pattern&gt;/\*&lt;/url-pattern&gt;

&lt;/filter-mapping&gt;

 

&lt;/web-app&gt;

 

四、在eclipse或myeclipse等IDE工具导入maven项目