springMVC第一个程序

  • 开发环境
    MyEclipse2014/Tomcat8.x/springMVC3.x

  • jar导入

com.springsource.org.aopalliance-1.0.0.jar
com.springsource.org.apache.commons.fileupload-1.2.0.jar
com.springsource.org.apache.commons.io-1.4.0.jar
com.springsource.org.apache.commons.logging-1.1.1.jar
org.springframework.aop-3.0.2.RELEASE.jar
org.springframework.asm-3.0.2.RELEASE.jar
org.springframework.beans-3.0.2.RELEASE.jar
org.springframework.context.support-3.0.2.RELEASE.jar
org.springframework.context-3.0.2.RELEASE.jar
org.springframework.core-3.0.2.RELEASE.jar
org.springframework.expression-3.0.2.RELEASE.jar
org.springframework.web.servlet-3.0.2.RELEASE.jar
org.springframework.web-3.0.2.RELEASE.jar
  • 配置web.xml
     
        springmvc
        org.springframework.web.servlet.DispatcherServlet
     
    
    
        springmvc
        *.do
    
  • 编写Controller类
public class TestController extends AbstractController {
    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest arg0,
            HttpServletResponse arg1) throws Exception {
        System.out.println("hello springmvc");
        return new ModelAndView("jsp1/index");
    }
}
  • 配置springmvc-servlet.xml文件
        
        
        
            
            
            
        
  • 结果

你可能感兴趣的:(springMVC第一个程序)