How to create maven project integrating SSH project - provide pom file

How to create maven project integrating SSH project - provide pom file
Personally pondering the original for a few days, please do not reprint without consent.
Different online search methods, this method can be used directly by importing IDE tools such as eclipse, myeclipse, etc.
 
1. Create the following directory structure
\src\main\java
\src\main\resources
\src\main\webapp\WEB-INF
\src\test\java
\src\test\resources
2. Create the following files in \src\main\webapp\WEB-INF
web.xml
struts.xml
applicationContext.xml
hibernate.cfg.xml
 
3. Create a pom file (key)
The content is as follows:
<?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项目
 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326572546&siteId=291194637