亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

android - Does anyone know what happens when an error occurs when the date is entered after the object of the java backend api interface is passed to the front end? Seek the guidance of the great God
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-06-12 09:19:10
0
1
822

My entity time field is of date type and is also formatted. Why does the front end report an error when inputting the date format?
Control layer code!
@ApiConfig(desc = "Modify or add active products", author = "cxf", status = Status.developing)

@ResponseBody
@RequestMapping(value = {"updateOrAdd"}, method = {RequestMethod.GET, RequestMethod.POST})
public String updateOrAdd(@ApiParam(name="產(chǎn)品json字符串")String products,@ApiParam(name="id!=null修改,id=null增加",
    excludes = {"id","actiDetailsList","pic","name"})ProActivityVO proActivity){
String strs = StringEscapeUtils.unescapeJava(products);
    List<ProductInfo> list = JSON.parseArray(strs, ProductInfo.class);
    return WebUtils.toJson(request, productInfoService.updateOrAdd(list, proActivity));

}

Fields of entity class
public class ProActivityVO{

@FieldDesc(name="活動(dòng)開始時(shí)間")
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Date onTime;

@FieldDesc(name="活動(dòng)結(jié)束時(shí)間")
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Date endTime;

}

Tested page:
products (product json string):

content (activity content):

title (activity title):

shopId (the store id):

activityPrice (activity price):

onTime (activity start time):

endTime (activity end time):

img(activity picture):

PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證高級(jí)PHP講師

reply all(1)
phpcn_u1582

spring has a message processor, you can take a look

/** 解析json返回?cái)?shù)據(jù) **/
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();

    List<MediaType> mediaTypes = new ArrayList(converter.getSupportedMediaTypes());
    converter.setSupportedMediaTypes(mediaTypes);
    mediaTypes.addAll(Arrays.asList(MediaType.TEXT_PLAIN, MediaType.TEXT_HTML, MediaType.TEXT_XML));

    ObjectMapper objectMapper = converter.getObjectMapper();
    objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));

    converters.add(converter);
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template