web

Posted cashew

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了web相关的知识,希望对你有一定的参考价值。

直接打印信息到页面
resultMap.put(Constants.Attrs.ERR_CODE, Constants.Config.STR_500);
resultMap.put(Constants.Attrs.ERR_MSG, Constants.TipMsg.ORDER_NOT_EXIST);
response.getWriter().write(JSON.toJSONString(resultMap));

转发,1个request,
request.setAttribute(Constants.Attrs.Content, Constants.TipMsg.QRCODE_HAS_USED);
request.getRequestDispatcher("/alreadyUse.html").forward(request, response);

重定向 2个request,变地址
response.sendRedirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appId + "&redirect_uri="+baseServer+"orderInfo/wxpay&response_type=code&scope=snsapi_userinfo&state=" + orderNum ); // + "&connect_redirect=1");

ModelAndView mv
mv.addAllObjects(resultMap);
mv.setViewName("error");
mv.setViewName("payDetail");

WebMvcConfigurer 配置HandlerInterceptor拦截器addInterceptors、静态资源映射addResourceHandlers、MultipartConfigElement等

BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
out.write(result.get("paySuccess").getBytes());
out.flush();
out.close();

@PostMapping("transact")
@ApiOperation(value = "办理长租")  , notes =
@ApiImplicitParams({
        @ApiImplicitParam(name = "longRentCars", value = "长租车辆数组", required = true, example = "[{"carPlatenum":"bgyl","parkingId":"619c2cab357e429d8f8904fb25ae1eb1"},{"carPlatenum":"silasila","parkingId":"619c2cab357e429d8f8904fb25ae1eb1"}]"),
        @ApiImplicitParam(name = "longRentRecord", value = "长租记录数据", required = true, example = "[{"type":1,"rentFee":123,"rentStartTime":"2019-01-10","rentEndTime":"2019-01-10","restDay":30,"area":"北1区","status":1,"parkingId":"619c2cab357e429d8f8904fb25ae1eb1"}]"),
        @ApiImplicitParam(name = "longRentUser", value = "长租用户数据", required = true, example = "[{"key":"longRentUser","value":"{userName:\"张学友\",conNum:\"132456789\"}","description":""}]")
})
public RestResponse transactLongRent(String longRentCars, String longRentRecord, String longRentUser) {
    return this.wrap(longRentService.transactLongRent(longRentCars, longRentRecord, longRentUser));
}

 @Override
public Object transactLongRent(String longRentCars, String longRentRecord, String longRentUser) {
    if (StringUtils.isEmpty(longRentCars) || StringUtils.isEmpty(longRentRecord) || StringUtils.isEmpty(longRentUser)) {
        return "参数不能为空";
    }
    List<LongRentCar> cars = JSON.parseArray(longRentCars, LongRentCar.class);
    List<LongRentRecord> rentRecords = JSON.parseArray(longRentRecord, LongRentRecord.class);
    LongRentUser user = JSON.parseObject(longRentUser, LongRentUser.class);
    if (null == user || StringUtils.isEmpty(user.getUserName())) {
        return "参数无效";
    }

以上是关于web的主要内容,如果未能解决你的问题,请参考以下文章

代码片段 - Golang 实现简单的 Web 服务器

高效Web开发的10个jQuery代码片段

高效Web开发的10个jQuery代码片段

web前端开发JQuery常用实例代码片段(50个)

几条jQuery代码片段助力Web开发效率提升

markdown 在Intel Nuc上设置Ubuntu Web服务器,步骤和代码片段