1.1 非註解的處理器映射器
處理器映射器:
org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping
另一個映射器:
org.springframework.web.servlet.handler.SimpleUrlHandlerMapping
多個映射器可以並存,前端控制器判斷url能讓哪些映射器映射,就讓正確的映射器處理。
1.2 非註解的處理器適配器
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter
要求編寫的Handler實現 Controller接口。
org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter
要求編寫的Handler實現 HttpRequestHandler接口。
//使用此方法可以通過修改response,設置響應的數據格式,比如響應json數據
/*
response.setCharacterEncoding("utf-8");
response.setContentType("application/json;charset=utf-8");
response.getWriter().write("json串");*/