码迷,mamicode.com
首页 > 编程语言 > 详细

使用netbeans 搭建maven工程 整合spring springmvc框架

时间:2018-11-10 15:05:00      阅读:597      评论:0      收藏:0      [点我收藏+]

标签:asp   jdbc   ati   按钮   ase   rtu   beans   springmvc   work   

使用netbeans7.4

自带的tomcat7.0

所以jdk选择7.xx

技术分享图片

等待生成空的工程

 技术分享图片

新建web.xml

技术分享图片

在pom.xml中添加spring的引用

 1      <dependency>
 2             <groupId>org.springframework</groupId>
 3             <artifactId>spring-aspects</artifactId>
 4             <version>4.2.0.RELEASE</version>
 5         </dependency>
 6         <dependency>
 7             <groupId>org.springframework</groupId>
 8             <artifactId>spring-context</artifactId>
 9             <version>4.2.0.RELEASE</version>
10         </dependency>
11         <dependency>
12             <groupId>org.springframework</groupId>
13             <artifactId>spring-context-support</artifactId>
14             <version>4.2.0.RELEASE</version>
15         </dependency>
16         <dependency>
17             <groupId>org.springframework</groupId>
18             <artifactId>spring-expression</artifactId>
19             <version>4.2.0.RELEASE</version>
20         </dependency>
21         <dependency>
22             <groupId>org.springframework</groupId>
23             <artifactId>spring-instrument</artifactId>
24             <version>4.2.0.RELEASE</version>
25         </dependency>
26         <dependency>
27             <groupId>org.springframework</groupId>
28             <artifactId>spring-instrument-tomcat</artifactId>
29             <version>4.2.0.RELEASE</version>
30         </dependency>
31         <dependency>
32             <groupId>org.springframework</groupId>
33             <artifactId>spring-jdbc</artifactId>
34             <version>4.2.0.RELEASE</version>
35         </dependency>
36         <dependency>
37             <groupId>org.springframework</groupId>
38             <artifactId>spring-jms</artifactId>
39             <version>4.2.0.RELEASE</version>
40         </dependency>
41         <dependency>
42             <groupId>org.springframework</groupId>
43             <artifactId>spring-orm</artifactId>
44             <version>4.2.0.RELEASE</version>
45         </dependency>
46  
47         <dependency>
48             <groupId>org.springframework</groupId>
49             <artifactId>spring-oxm</artifactId>
50             <version>4.2.0.RELEASE</version>
51         </dependency>
52  
53         <dependency>
54             <groupId>org.springframework</groupId>
55             <artifactId>spring-test</artifactId>
56             <version>4.2.0.RELEASE</version>
57         </dependency>
58  
59         <dependency>
60             <groupId>org.springframework</groupId>
61             <artifactId>spring-tx</artifactId>
62             <version>4.2.0.RELEASE</version>
63         </dependency>
64         <dependency>
65             <groupId>org.springframework</groupId>
66             <artifactId>spring-web</artifactId>
67             <version>4.2.0.RELEASE</version>
68         </dependency>
69  
70         <dependency>
71             <groupId>org.springframework</groupId>
72             <artifactId>spring-webmvc</artifactId>
73             <version>4.2.0.RELEASE</version>
74         </dependency>
75  
76         <dependency>
77             <groupId>org.apache.poi</groupId>
78             <artifactId>poi</artifactId>
79             <version>3.13</version>
80         </dependency>
81         <dependency>
82             <groupId>org.springframework</groupId>
83             <artifactId>spring-aop</artifactId>
84             <version>4.2.0.RELEASE</version>
85         </dependency>

然后新建spring的配置文件applicationContext

 技术分享图片

下边,,如果有按钮,根据按钮提示,添加 springframework技术分享图片

然后在web.xml添加spring的配置文件

 <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
    <!-- 指定Spring Bean的配置文件所在目录。默认配置在WEB-INF目录下 -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:*applicationContext.xml</param-value>
    </context-param>
    <!--SPRING MVC 配置-->
    <servlet>
        <servlet-name>spring</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:*spring-servlet.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>spring</servlet-name>
        <url-pattern>/</url-pattern>
        <!--注意/和/*的区别-->
    </servlet-mapping>

 

使用netbeans 搭建maven工程 整合spring springmvc框架

标签:asp   jdbc   ati   按钮   ase   rtu   beans   springmvc   work   

原文地址:https://www.cnblogs.com/jnhs/p/9938791.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!