springmvc编写一个handle

1.配置web.xml文件


springmvc编写一个handle

2.配置spring-mvc.xml

包括处理器适配器处理器解析器 视图解析器

springmvc编写一个handle

3.创建一个handle集成 controler

package springmvc;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

import org.springframework.web.servlet.mvc.Controller;

public class itemclass implements Controller {

@Override

public ModelAndView handleRequest(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception {

// TODO Auto-generated method stub

ModelAndView andView = new ModelAndView();

andView.setViewName("/WEB-INF/jsp/newmod.jsp");

return andView;

}

}

4.随便编写的jsp页面


springmvc编写一个handle

5.测试


springmvc编写一个handle