实现Spring 4 MVC HelloWorld Tutorial – Full XML Example
2016-09-07 00:00
519 查看
摘要: Spring 4 MVC
Version: Neon Release (4.6.0)
Build id: 20160613-1800
![](http://static.oschina.net/uploads/space/2016/0907/142717_UjcR_2326611.png)
其中创建maven项目后,红色框框里面的内容是需要手动创建。
利用maven install生成war文件,然后在tomcat的webapps运行,通过url可以访问。
![](http://static.oschina.net/uploads/space/2016/0907/142939_mpUD_2326611.png)
![](http://static.oschina.net/uploads/space/2016/0907/142952_Rnxo_2326611.png)
另外创建工程过程中遇到的问题:
原始的web.xml中的内容:
参考链接
http://websystique.com/springmvc/spring-4-mvc-helloworld-tutorial-full-example/环境:
Eclipse Java EE IDE for Web Developers.Version: Neon Release (4.6.0)
Build id: 20160613-1800
project结构图:
![](http://static.oschina.net/uploads/space/2016/0907/142717_UjcR_2326611.png)
其中创建maven项目后,红色框框里面的内容是需要手动创建。
利用maven install生成war文件,然后在tomcat的webapps运行,通过url可以访问。
![](http://static.oschina.net/uploads/space/2016/0907/142939_mpUD_2326611.png)
![](http://static.oschina.net/uploads/space/2016/0907/142952_Rnxo_2326611.png)
另外创建工程过程中遇到的问题:
原始的web.xml中的内容:
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">[/code] 需要修改为:<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
否则会有报错。
原因为eclipse java ee默认的Dynamic Web Module版本和原始的web.xml指定的版本不一致
相关文章推荐
- Spring 4 MVC HelloWorld Tutorial – Full XML Example
- http://crunchify.com/simplest-spring-mvc-hello-world-example-tutorial-spring-model-view-controller-tips/ 非常棒的spring入门,maven,以及eclipse
- Spring MVC Hello World Example
- Spring MVC hello world annotation example
- Spring 3 Hello World Example / Tutorial using Maven Tool and Eclipse IDE
- Spring MVC hello world annotation example
- Spring 3 MVC hello world example – Annotation
- Spring MVC hello world example
- spring-3-mvc-hello-world-example
- Spring 3 MVC hello world example – Annotation
- Spring MVC Hello World Example(转)
- Gradle – Spring 4 MVC Hello World Example
- Spring 3 MVC hello world example
- Spring 4 MVC hello world 教程-完全基于XML(带项目源码)【超赞】
- Gradle – Spring 4 MVC Hello World Example – Annotation
- Spring MVC hello world annotation example
- springmvc + freemarker 实现hello-world
- Spring MVC HelloWorld实现
- Spring 3 MVC hello world example
- Spring 3 MVC Framework Based Hello World Web Application Example Using Maven, Eclipse IDE And Tomcat