总结总结
1、springboot
在springboot中,它有@springbootApplication这个注解,前端访问后台,它会扫描到这个注解所在的包的子包中的所有包含@controller的类,或者是包含@RestController,这两个类的区别是后者是@RespondBody+@Controller的集合,可返回数据,也可以返回页面,前者只能返回页面。
扫描到这两个注解的类后,就会去匹配url,如果url匹配得上,就可以访问该url下的方法。
如果@springbootApplication和@controller不在同一个包下,需要在启动类上加@ComponentScan(basePackages={“xxx.xxx.xx”,“xxx.xxx.xx”}),让启动类知道你的controlle包的位置,然后去扫描
@springbootApplication——》找到@Controller/@RestController的类,进行url匹配,匹配成功进行方法的访问
2、ssm
在web.xml配置中,先会匹配到url——》根据servlet-name——》找到DispatcherServlet,加载springmvc.xml——》扫描controller包——》找url,匹配得上就访问url下的方法
3、struts
这个框架就比较旧了
这个没有学,先去了解一下,后面更新。
4、servlet
在web.xml中,先会找到url——》根据servlet-name找到对应的servle.class——》再进行action方法的匹配,匹配得上就进行访问