今天测试,出现一个奇怪的问题
$.ajax传输js数组,spring接收这个数组,出现奇怪的现象,如果数组只有一个元素,且这个元素字符串最后一个字符是以逗号,结尾的话,
spring会自动把这个逗号去除,且不报错。。。。
如果数组含有2个及以上,却可以正常显示这个逗号。。。。
如果换成是其他符号结尾则可以正常使用!!!!
我的猜测是ajax或者spring把数据给处理了,一个元素,默认视为一个字符串,导致把多余的分隔符逗号移除了
不知道为什么,百度也没找到关于这个的资料,以此记录