
SpringMVC
这周内过第一遍
我叫山鸡996
这个作者很懒,什么都没留下…
展开
-
49-54、restful初识
占个地儿原创 2022-02-13 01:25:51 · 149 阅读 · 0 评论 -
1-10mvc
1、课程介绍2、导学3、回顾mvc4、简介5、开发环境6、创建maven工程导入外部依赖<dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>5.3.原创 2022-02-13 01:20:54 · 84 阅读 · 0 评论 -
接受请求参数与数据回显
接受请求参数与数据回显原来处理数据方式:request.getParameter();1、提交的域名和处理方法的参数名一致2、提交的域名和处理方法的参数名不一致举例提交数据localhost:8080/hello?username=kuagnshen处理方法@RequestMapping("/hello")public String hello(@RequestParam("username") String name){ sout(name); return "hello";}原创 2021-12-27 15:22:29 · 364 阅读 · 0 评论 -
RequestMapping说明
9、RequestMapping说明作用用于映射@Controller//@RequestMapping("/c3")public class ControllerTest3{ @RequestMapping("/t1") public String test1(Model model){ //封装数据 model.addAttribute("msg","controllerTest3"); return "test"; }}localhost:8080/c3/原创 2021-12-27 14:27:14 · 87 阅读 · 0 评论 -
controller配置
controller配置解析用户请求 并返回给视图解析器。2、编写一个controller类3、去spring配置文件注册请求的bean;name对应请求路径,class对应处理请求的类。<bean name="/t1" class="com.kuang.controller.ControllerTest1"/>@Controller注解类型用于声明spring类的实例是一个控制器。需要在配置文件中声明组件扫描并<context:conponent-scan base-pa原创 2021-12-27 14:07:43 · 239 阅读 · 0 评论 -
使用注解开发springmvc
7、注解开发springmvc第四步:配置web.xml@Controller//@RequestMapping("/hello")public class HelloController{ @RequestMapping("/h1") public String hello(Model model){ //封装数据 model.addAttribute("msg","hello.springmvcAnnotation"); return "hello"; //会被视图解析原创 2021-12-27 12:23:35 · 68 阅读 · 0 评论 -
深入springmvc学习
SpringMvc深入学习1、配置DispatchServlet请求分发器,前端控制器<servlet> <servket-name>springmvc</servket-nameservlet-name> <servlet-class>DispatcherServlet</servlet-classs></servlet>//dispagservlet要绑定spring的配置文件<init-param原创 2021-12-27 11:40:45 · 80 阅读 · 0 评论