随笔分类 -  java——spring boot

摘要:package org.example.controller.requestparam; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestM 阅读全文
posted @ 2023-01-15 21:56 小白龙白龙马
摘要:package org.example.controller.requestparam; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestM 阅读全文
posted @ 2023-01-15 21:14 小白龙白龙马
摘要:package org.example.controller.requestparam; import org.springframework.ui.Model; import org.springframework.ui.ModelMap; import org.springframework.w 阅读全文
posted @ 2023-01-15 20:46 小白龙白龙马
摘要:Spring MVC 中,控制器在接收到 DispatcherServlet 分发过来的请求后,会继续调用 Model 层对请求进行处理。Model 层处理完请求后的结果被称为模型数据,会将模型数据返回给 Controller。 Controller 在接收到 Model 层返回的模型数据后,下一步 阅读全文
posted @ 2023-01-15 17:07 小白龙白龙马
摘要:通过实体类对象获取(推荐) 我们可以在 Controller 控制器方法的形参中设置一个实体类形参,如果请求参数的参数名与实体类中的属性名一致,那么 Spring MVC 会自动将请求参数封装到该实体类对象中。此时我们就可以通过该实体类对象获取所需的请求参数了。 注:我们推荐大家使用实体类对象来获取 阅读全文
posted @ 2023-01-15 15:10 小白龙白龙马
摘要:之前有一个遗留问题,如下: package org.example.controller.requestparam; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annot 阅读全文
posted @ 2023-01-15 14:32 小白龙白龙马
摘要:我们可以在 Controller 的控制器方法中设置与请求参数同名的形参,以获取请求中携带的参数。当浏览器发送的请求匹配到这个控制器方法时,Spring MVC 会自动将请求参数赋值给相应的方法形参。 通过控制器方法的形参获取请求参数时,我们需要注意以下几点。 1. 必须保证参数名一致 我们必须保证 阅读全文
posted @ 2023-01-15 14:10 小白龙白龙马
摘要:我们可以在控制器方法中设置一个 HttpServletRequest 类型的形参, Spring MVC 会自动将请求中携带的参数封装到 HttpServletRequest 形参中, 然后我们就可以通过 HttpServletRequest 提供的 getParameter() 方法获取所需的请求 阅读全文
posted @ 2023-01-14 17:15 小白龙白龙马
摘要:Filter_细节_web.xml配置方式 下面这个是注解配置: 把这个注解注释掉之后,此类就不是过滤器了。需要重新在xml里面配置声明: xml配置如下: Filter_细节_执行流程&生命周期 生命周期: 配置详解: 阅读全文
posted @ 2023-01-13 23:03 小白龙白龙马
摘要:package org.example.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestCont 阅读全文
posted @ 2023-01-12 22:42 小白龙白龙马
摘要:package org.example.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestCont 阅读全文
posted @ 2023-01-12 22:26 小白龙白龙马
摘要:package org.example.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestCont 阅读全文
posted @ 2023-01-11 23:20 小白龙白龙马
摘要:代码: package org.example.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.Rest 阅读全文
posted @ 2023-01-11 21:52 小白龙白龙马
摘要:注意:只能在一次请求转发中使用。 package org.example.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.an 阅读全文
posted @ 2023-01-08 18:54 小白龙白龙马