1、2015 最简单的 Spring MVC 入门教程

Crunchify 有关 Spring MVC 的方方面面汇总

太阳火神的美丽人生 (http://blog.csdn.net/opengl_es)

本文遵循“署名-非商业用途-保持一致”创作公用协议

转载请保留此句:太阳火神的美丽人生 -  本博客专注于 敏捷开发及移动和物联设备研究:iOS、Android、Html5、Arduino、pcDuino否则,出自本博客的文章拒绝转载或再转载,谢谢合作。


从 Crunchify 获得到一篇文章,终于搞定 Spring MVC 4.2.2 的控制器映射与视图模板解析。

这个版本之前的版本都是正常的,为什么到这个版本就会有问题呢?!

初步比较,发现,这一篇是建立动态 Web 工程,再转成 Maven 项目,而我之前是直接创建的 Maven 项目,

有时间再详细比较问题所在


下面将持续更新在使用 Maven 重新构建 Spring MVC 项目过程中,关于 映射控制器、视图模板解析、静态资源配置、Mybatis 自动映射等等相关零散用到过的技术,一是做个总结加深,二是疏理出脉络,日后再用也不至于又得重新捡起。


使用 Maven 如果有梯子,那么就得用好 Maven 的国内镜像,这个可以参考:


1、2015 最简单的 Spring MVC 入门教程

Eclipse: Missing web.xml file? How can I create web.xml in Eclipse?

Java Properties File: How to Read config.properties Values in Java?

Step by Step guide to Enable HTTPS or SSL correct way on Apache Tomcat Server – Port 8443

此部分相关的 Spring 框架官方文档链接如下:

21.2 The DispatcherServlet

21.3 Implementing Controllers

21.5 Resolving views

22.5 JSP & JSTL



2、Spring MVC 4.2.2 集成静态资源

注意,原文中 <link href="${crunchifyCSS}" rel="stylesheet" /> 这一行,缺少个 $ 需要加上。

按照 welcome.jsp 中的样式,如法炮制,把图片静态资源的位置变量及图片引用加上,同时需要整体将 js、css、img 分目录列入 resources 中。


此部分相关的 Spring 框架官文文档链接如下:

21.16.9 Serving of Resources


3、多文件上传保存到指定位置

注意,原文中文件上传的 jsp 中有部分可能无法正确显示,可摘取以下部分替换:

<script>
    $(document).ready(
		function() {
			//add more file components if Add is clicked
			$('#addFile').click(
				function() {
					var fileIndex = $('#fileTable tr').children().length;
					$('#fileTable').append(
						  '<tr><td>'
						+     '<input name="files['+ fileIndex +']" type="file" />'
						+ '</td></tr>'
					);
				}
			);
		}
	);
</script>



http://crunchify.com/how-to-fix-cannot-change-version-of-project-facet-dynamic-web-module-to-3-0-error-in-eclipse/

http://crunchify.com/how-to-create-a-war-file-from-eclipse-using-maven-plugin-apache-maven-war-plugin-usage/

http://crunchify.com/spring-mvc-tutorial-how-to-upload-multiple-files-to-specific-location/

http://crunchify.com/how-to-use-ajax-jquery-in-spring-web-mvc-jsp-example/

http://crunchify.com/how-to-create-restful-java-client-using-apache-httpclient-example/

http://crunchify.com/crunchifyjsontohtml-js-json-to-html-table-converter-script/

http://crunchify.com/spring-mvc-introduction-to-spring-3-mvc-framework/

http://my.oschina.net/laigous/blog/309128

http://mybatis.github.io/spring/zh/mappers.html

http://www.tuicool.com/articles/Fru26n





猜你喜欢

转载自blog.csdn.net/sleks/article/details/49384057