前端date类型的数据,后端如何接收

2025-10-22 14:19:17

1、   @RequestMapping(value = "/add",method = RequestMethod.POST)

    @ResponseBody

    public Map<String,Object> add(Product product){   

    Map<String,Object> maps = new HashMap<String,Object>();   

    try {

    productService.save(product);

    

前端date类型的数据,后端如何接收

2、maps.put("message", "100");

} catch (Exception e) {

// TODO: handle exception

}

        return maps;

    }

后端实体对象直接

前端date类型的数据,后端如何接收

3、  @InitBinder

public void initBinder(WebDataBinder binder){

DateFormat format = new SimpleDateFormat("yyyy-MM-dd");

binder.registerCustomEditor(Date.class, new CustomDateEditor(format,true));

}

后端必须配置,springmvc 默认不会自动转换date

前端date类型的数据,后端如何接收

4、<div style="margin-top: 10px;">

<div class="col-xs-6 col-md-4" style="border-right: 2px solid #eee;">

政府认证

</div>

<div class="col-xs-6 col-md-4" style="border-right: 2px solid #eee;">

质量保证

</div>

<div class="col-xs-6 col-md-4">

公司担保

</div>

</div>

前端date类型的数据,后端如何接收

5、<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">

<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>

<span class="sr-only">Previous</span>

</a>

前端date类型的数据,后端如何接收

6、<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">

<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>

<span class="sr-only">Next</span>

</a>

前端date类型的数据,后端如何接收

7、@RequestMapping(value = "/delete",method = RequestMethod.POST)

    @ResponseBody

    public Map<String,Object> delete(

            @RequestParam("ids[]") List<Long> ids){

        Map<String,Object> result = new HashMap<>();

        try{

        for(Long i:ids){

        productService.delete(i);

        }          

            result.put("success",true);

        }catch (RuntimeException e){

            e.printStackTrace();

            result.put("success",false);

            result.put("errorInfo",e.getMessage());

        }

        return result;

    }

前端date类型的数据,后端如何接收

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢