Spring MVC中的Servlet [英] Servlets in spring mvc
问题描述
我对servlet和spring mvc有基本的了解.但是我不知道spring mvc中是否使用过servlet.在spring mvc中,我们有控制器类.我的想法是,servlet在spring mvc中用作控制器.如果我不正确,请纠正我.
I have fundamental idea about servlet and spring mvc. But I don't know that there is a usage of servlets in spring mvc or not. In spring mvc we have controller classes. My thinking is servlet is used in spring mvc as a controller. If I'm incorrect please correct me.
推荐答案
是的,您完全正确. Servlet用于Spring-MVC.在Spring-MVC中,当您编写@Controller之类的注释时,您间接使用的是一个名为Dispatcher Servlet的Servlet.分派器Servlet在web.xml文件中定义,具有属性和类名,该属性和类名映射到.jsp页面和Controller部分.
Yes,you are perfectly right. Servlets are used in Spring-MVC. In Spring-MVC when you write annotation like @Controller, indirectly you are using a Servlet called Dispatcher Servlet. Dispatcher Servlet is defined in web.xml file with properties and class name which is mapped to .jsp pages and Controller part.
这篇关于Spring MVC中的Servlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!