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

Build Spring MVC development environment

时间:2017-11-20 01:15:05      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:spring mvc

Short memo for how to build Spring MVC develepmnet environment (for windows). In case you have any questions, please feel free to leave message to me under this article. I will update and add more details according to your concern. 


Firstly, please make sure you have eclispe and tcomcat installed locally and intergrated as expected.


1.Spring framwork download

http://repo.spring.io/release/org/springframework/spring/ 

技术分享图片


2. Apachce Commons Logging Download

https://commons.apache.org/proper/commons-logging/ 

技术分享图片

(Download commons-logging-1.2-bin.zip, you can also find it in attached file)

技术分享图片

3.two more jstl jar (Please refer to attached files.)

技术分享图片


Now Config and Test.


New Dynamic Web Project on Eclipse (Project Name: spring-mvc-demo)

技术分享图片

Copy all the jar files to /WEB-INF/lib 

技术分享图片

Config xml files under WEB-INF. (Please find them in attached file)

技术分享图片

Create Congtroller class. (HomeController.java)

Define Controller method.

Add Request Mapping to Controller method

Return View Name

package com.marvin.springdemo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeController {
  @RequestMapping("/")
  public String showPage() {
   // return to main-menu page
   return "main-menu";
  }
}

Develop View Page (main-menu.jsp)

<!DOCTYPE html>
<html>

<body>
<h2>Spring MVC Demo - Home Page</h2>
</body>
</html>

File hierachy.

技术分享图片

Run on Server

技术分享图片





本文出自 “Marvin” 博客,请务必保留此出处http://marvinchen.blog.51cto.com/6457668/1983354

Build Spring MVC development environment

标签:spring mvc

原文地址:http://marvinchen.blog.51cto.com/6457668/1983354

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