非注解处理器映射器
1. org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping
url 到bean name的映射
2. org.springframework.web.servlet.handler.SimpleUrlHandlerMapping
url 到bean id的映射
非注解适配器
1. org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter
要求编写的Handler实现Controller接口
2. org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.class
要求编写的Handler实现HttpRequestHandler接口
处理器Handler
1. implements org.springframework.web.servlet.mvc.Controller
2. implements org.springframework.web.HttpRequestHandler
处理器代码:
ItemsController1因为和SimpleControllerHandlerAdapter适配,因此实现Controller接口
package wzd.pkg.ssm.controller; 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 ItemsController1 implements Controller { @Override public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { //调用service查找数据库,查询商品列表。 //返回ModelAndView ModelAndView modelAndView=new ModelAndView(); //相当于request的setAttribute,在jsp页面中通过itemsList取数据 modelAndView.addObject("itemsList", "controller1 content"); modelAndView.setViewName("/WEB-INF/jsp/items.jsp"); return modelAndView; } }