• 2024-07-01pageHelper在Spring框架中pageSize无法修改的问题
    以前在Springboot中分页是使用pageHelper的,然后想当然的以为在老项目Spring框架上也可以完美复制粘贴进去,结果运行起来pageHelper的pageSize一直是全部列表的长度,即(total始终等于pagesize,page始终等于1)这就相当于没分页。后来发现,pageHelper在Spring中的写法和Springboot的是
  • 2024-06-21springMvc 接收文件 MultipartFile
    使用SpringMVC 的controller中接收文件,如果只是接收一个文件,声明MultipartFile或者指定@RequestParam注解,参数(strReqBody和 images)与前端参数一致即可例:第一种方式publicvoiduploadImg(MultipartFileimg){}第二种public void uploadImg(SringstrReqBody,@Req
  • 2024-06-19打卡12
    所花时间(包括上课): 2h代码量(行): 150左右搏客量(篇): 1了解到的知识点:springboot备注(其他): packagecom.leap.jixianceshiboot.controller;importcom.leap.jixianceshiboot.entity.Policy;importcom.leap.jixianceshiboot.entity.Poli
  • 2024-06-18课设--学生成绩管理系统(核心代码部分)
    欢迎来到 Papicatch的博客系统介绍课设--学生成绩管理系统(一)-CSDN博客课设--学生成绩管理系统(二)-CSDN博客课设--学生成绩管理系统(三)-CSDN博客目录
  • 2024-06-02SpringBoot常用注解
    1、bean相关注解注解名作用@Component将类交给SpringBoot管理@Repository放在dao层@Service放在service层,即业务服务层@Controller放在控制层,即handler层@RestController@Response和@Controller的组合注解,返回的是JSON数据@Configuration声明一个类为配置类,常和Bean、Scope
  • 2024-05-29controller层
     所花时间(包括上课): 1 h左右代码量(行): 200  左右搏客量(篇):1了解到的知识点: controller层接口实现备注(其他): packagecom.leap.jixianceshiboot.controller;importcom.leap.jixianceshiboot.entity.Policy;importcom.leap.jixianceshiboot.
  • 2024-04-22Spring中将@RequestParam绑定到对象(转)
    译文:https://blog.csdn.net/dnc8371/article/details/106810876/译文作者:dnc8371来源:CSDN原文:https://www.javacodegeeks.com/2018/10/how-bind-requestparam-object-spring.html您是否在请求映射方法中用@RequestParam注释了多个参数,并认为它不可读?当请求中需要一个或两个输
  • 2024-04-07前后端接口写法(传输数据)
    目录前言1.零散数据2.函数体3.总结前言对于后端常用的两个注解:详细分析Java中的@RequestParam和@RequestBody以下文章主要用于笔记总结,后续可翻看1.零散数据前端数据exportconstdoWeekPlan=(ids,selectedPeriod)=>{returnrequest({url:'/api
  • 2024-03-18@RequestParam
    @RequestParam注解是用于从请求的参数中获取值的SpringMVC注解。它可以应用在方法的参数上,将请求参数的值绑定到方法的参数上。@RequestParam注解有以下作用:获取请求参数的值:通过@RequestParam注解,可以将请求中的特定参数的值绑定到方法的参数上。例如,如果请求中包含名为"nam
  • 2024-03-13springboot的代理模式示例----面向切面编程
    1.定义切面类 2.编写切面类importcom.alibaba.fastjson.JSON;importcom.fasterxml.jackson.databind.ObjectMapper;importcom.xlkh.bigscreen.common.utils.RedisDeviceUtil;importcom.xlkh.bigscreen.service.bigscreen.BigscreenRedisService;importcom.xlkh.bigs
  • 2024-03-13SpringBoot Controller接收参数的常用方式总结
    原生的HttpServletRequest可和其他注解配合使用,是内置对象,是整个请求可获取到所有的数据请求路径参数@PathVariable请求路径参数例如url/{id},则获取id参数。@PathVariabel(name="xx")@RequestParam例如url?name=xxx。@RequestParam(name="xx")Body参数@Req
  • 2024-03-02关于SpringMVC中@RequestMapping的params参数
    @RequestMapping注解的params参数同一个url,只要params不同,springmvc也是会区分匹配的。@PostMapping("/reduceProductStock")publicStringreduceProductStock(@RequestParamLongproductId,@RequestParamIntegerquantity){productService.reduceProductStock(pr
  • 2024-01-262024年1月Java项目开发指南14:关于post中的body和param以及java中的@RequestBody和@RequestParam
    在HTTP请求中,POST方法通常用于向服务器发送数据,这些数据可以在请求的body中,也可以在URL的param中。不过,这两者的使用方式和适用场景是不同的。Body:在POST请求中,body主要用于包含要发送到服务器的数据。这些数据通常是表单数据、JSON数据或其他类型的数据。当你需要在请求体中发送
  • 2024-01-18SpringMVC中@pathVariable 为spring的注解,都可以用在Controller 层接受前段传递的数据,不过二者的应用场景不同。
    @PathVariable主要接收http://host:port/path{参数值}数据 @pathVariable作为借口是,url是http"//ww.yoodb.com/user/getUserById/2 @RequestParam主要用于接受http://host:port/path?参数名=值数据值 @ResquesrParam请求接口时,url是http://www.yoodb.com/user/getUsrBy
  • 2023-12-31JavaWebDay10
    开发规范restful表属性状态转换,是一种软件架构风格,注意rest是风格为约定方式可以打破,藐视模块的功能通常使用复数加s,表示此类资源要有一个统一响应数据的格式通常用result实体类来封装当想给参数设置默认值可以使用@requestparam注解后括号接defaultvalue=“1” 
  • 2023-12-302023-12-30
    packagecom.example.backendmanage.controller;importcom.example.backendmanage.common.AjaxResult;importcom.example.backendmanage.info.Role;importcom.example.backendmanage.mapper.RoleMapper;importorg.springframework.beans.factory.annotation.Autowired;imp
  • 2023-12-21注解
    @RequestParam请求参数名与形参集合对象名相同且请求参数为多个默认情况下,请求中参数名相同的多个值,是封装到数组。如果要封装到集合,要使@RequestParam绑定参数关系。eg.(@RequestParamListhobby)@DateTimeFormat对于日期类型的参数进行封装,eg.@DateTimeFormat(pat
  • 2023-12-19启用微服务报错:Method has too many Body parameters
    启用微服务报错:MethodhastoomanyBodyparameterspackagecom.llq.springcloud.controller;@RestControllerpublicclassStorageController{@ResourceprivateStorageServicestorageService;//扣减库存你@PostMapping("/storage/reduce")
  • 2023-12-112023-12-11
    packagecom.example.backendmanage.controller;importcom.example.backendmanage.common.AjaxResult;importcom.example.backendmanage.info.UploadFile;importcom.example.backendmanage.mapper.FileMapper;importcom.example.backendmanage.mapper.FileMapper2;i
  • 2023-12-10解决ERP多表关联查询时所遇到的问题.
    1.在编写多表查询代码时遇到如下问题(导致数据不能正确显示)通过查询资料知道了,这是因为对于前端传过来的参数,springboot通常通过如下三个注解接受参数:@PathVariable@RequestParam@RequestBody每个方式有不同支持的请求参数的形式注解支持的类型支
  • 2023-12-04SpringMVC中 @RequestParam 与 @PathVariable 区别
    两者都是用来修饰形参两者都是用来绑定访问路径的参数名、形参名称两者接收URL方式不同@RequestParamhttp://www.example.com/pets?petId=3@Controller@RequestMapping("/pets")@SessionAttributes("pet")publicclassEditPetForm{//...@RequestMapping(me
  • 2023-12-01@RequestParam 注解导致无法自动将请求参数填充到函数参数中
    @RequestParam注解导致无法自动将请求参数填充到函数参数中@RequestParam注解通常用于从HTTP请求中提取单个参数值。它将参数值映射到方法的参数上,并且默认情况下不会自动将值填充到类的字段中。以下面的代码为例:classPageParam{ privateIntegerpage;privateInte
  • 2023-11-30接口参数默认值的坑
    先看接口@GetMapping("/queryByPage/{pageNum}/{pageSize}")@ApiOperation("分页查询学生")publicResult<Page<Student>>queryByPage(@RequestParam(required=true,defaultValue="1")@PathVariableIntegerpageNum,
  • 2023-11-30SpringBoot Resolved [org.springframework.web.multipart.support.MissingServletRequestPartException:
    SpringBootResolved[org.springframework.web.multipart.support.MissingServletRequestPartException:Requiredrequestpart'file'isnotpresent]IDEA报错信息这个错误主要主要是指后端通过@RequestParam("file")注解标注的MultipartFile参数并没有获取到文件参数为n
  • 2023-11-29SpringMVC_2023_11_28_1 SpringMVC_进阶(数据的接收)
    SpringMVC进阶2023-11-2910:13:40星期三数据的接收a)页面传递的属性名和后台接受的属性名不一致时,如何处理?@RequestParam("页面组件中的属性名")@RequestMapping(value="/login",method=RequestMethod.POST)publicStringlogin(@RequestParam("