springMVC给我们提供Controller控制器,用来实现我们的逻辑处理,在Controller接口中定义的方法也是比较简单的,以下:
Controller接口及实现类:
Controller有多个实现类,这些类就不做过量解释了,由于我们如果处理自己的业务还是需要重写他的handleRequest方法的。
Controller接口以下:
public interface Controller {
//履行要求处理操作,返回ModelAndView对象
ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception;
}
public class ProductImplementController implements Controller {
@Override
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
ModelAndView modelAndView = new ModelAndView("jsp/ProductForm");
return modelAndView;
}
}springMVC的容器配置文件中注入这个Controller
<bean name="/input.action" class="com.tianjunwei.controller.ProductImplementController"></bean>这样终究访问这个Controller时会跳到jsp/ProductForm的页面。
上一篇 移动端游戏架构设计
下一篇 射线检测算法在游戏中应用