正确输入应该是 http://localhost:8080/test?id=7777777 结果用户输入了 http://localhost:8080/test?id=bye
我该如何返回 json 中带 msg 告知用户输入参数错误 而不是返回 400
目前想法是接受 id 为 String,不过这也太蠢了,请问有其他方法吗?谢谢
try{
Integer idd = Integer.valueOf(id);
}catch(Exception e){
return Result.validationError("参数错误");
}