1.下载Tomcat,并添加如下用户环境变量,并添加CLASSPATH变量

  ### CATALINA_BASE F:\apache-tomcat-7.0.90
  ### CATALINA_HOME F:\apache-tomcat-7.0.90
  ### TOMCAT_HOME  F:\apache-tomcat-7.0.90\lib
  ### CLASSPATH  F:\apache-tomcat-7.0.90\lib

2.打开IDEA,新建一个Spring MVC工程
### ①自己定义工程名字
### ②将lib文件夹复制到web的WEB-INF下,并新建一个JSP文件夹
### ③点击File->Project Structure,选择modules->Dependencies->绿色加号->Jars..->选择WEB-INF下的lib
### ④将web.xml文件中的*.form改成/
### ⑤在src文件夹下新建包(com.lemon.like),然后新建一个Controller类(LemonController),内容如下
### package com.lemon.like;

### import org.springframework.stereotype.Controller;
### import org.springframework.ui.ModelMap;
### import org.springframework.web.bind.annotation.RequestMapping;

### @Controller
### public class LemonController {
###     @RequestMapping(value = "/hello")
###     public String Welcome(ModelMap model){
###         model.addAttribute("msg","Welcome to Spring MVC");
###         return "Welcome";
###      }
###  }
###
### ⑥在JSP文件夹下新建一个Welcome.jsp,内容如下
### <%@ page contentType="text/html;charset=UTF-8" language="java" %>
### <html>
###     <head>
###         <title>Welcome</title>
###     </head>
###     <body>
###         ${msg}
###     </body>
### </html>
### ⑦修改dispatcher-servlet.xml文件内容,修改完成之后如下
### ·<?xml version="1.0" encoding="UTF-8"?>
### <beans xmlns="http://www.springframework.org/schema/beans"
###        xmlns:context="http://www.springframework.org/schema/context"
###        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
###        xsi:schemaLocation="
###         http://www.springframework.org/schema/beans
###         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
###         http://www.springframework.org/schema/context
###         http://www.springframework.org/schema/context/spring-context-3.0.xsd">
###     <!--对应src下的报名,需要自己新建-->
###     <context:component-scan base-package="com.lemon.like" />
###     <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
###         <property name="prefix">
###             <!-- 这个配置是配置JSP页面的位置,按照你自己的配置来配 -->
###             <!--jsp文件夹需要自己手动创建-->
###             <value>/WEB-INF/JSP/</value>
###         </property>
###         <property name="suffix">
###             <value>.jsp</value>
###         </property>
###     </bean>
### </beans>·

###⑧修改tomcat->Edit configuration->加号->本地tomcat->设置好浏览器、名字、网页路径->Deployment->加号->Art..->ok

运行即可

 

表单出现bug,添加如下<jsp:useBean id="command" class="com.lemon.like.Student" scope="request" ></jsp:useBean>