我有
@RequestMapping(value ="/getTaxiByPhone",method = RequestMethod.GET)
public @ResponseBody
String getTaxiByPhone(@RequestParam ("phone") String phone){
int count=0;
for (int i=0; i<taxiList.size();i++){
if ((taxiList.get(i).getPhone()).equals(phone)){
count++;
}
}
return "found "+count;
}
@RequestMapping(value ="/getTaxiPhone",method = RequestMethod.GET)
public @ResponseBody
String getAllTaxi(@RequestParam ("id") int id){
return taxiList.get(id).getPhone();
}
@RequestMapping(value ="/getAllTaxi",method = RequestMethod.GET)
public @ResponseBody
List<Taxi> getAllTaxi(){
return taxiList;
}
例如getTaxi?id=2
返回{"taxi_city_id":[55000001,67000001],"taxi_id":1113,"taxi_name":"zxcv","taxi_phone":"+73812999997"}
,但如果您尝试getTaxiByPhone?phone=+73812999997
,则找不到任何对象,因为如果您尝试使用count(return "found "+count+" for phone"+ phone;
)返回phone参数,你会看到found 0 for phone 73812999997
。这意味着签署&#39; +&#39;春天解析网址丢失了。