嵌套异常是什么意思java.lang.NumberFormatException?

时间:2019-02-05 19:39:40

标签: typescript spring-boot ionic-framework

无法将类型“ java.lang.String”的值转换为所需的类型“ int”;嵌套的异常为java.lang.NumberFormatException:对于输入字符串:“ {” joinDate“:null,” name“:” Hamza“,” hospital_Clinic“:null,” doctor_name“:” Dr.Iqra“,” p_id“:4 }” ,在客户端,它获取ID但无法将其删除,每次发生相同的错误时,我都无法理解这里发生的事情,谁能解释一下为什么这个错误再次出现,谢谢,这是代码:

#provider.ts

@Injectable()
export class DatabasedataProvider {
  public allpatient:Patient[]=[];
  public url:string = "http://localhost:8080";


  constructor(private http: HttpClient) {

  }
  getAllPatient(): Observable<any> {

    return this.http.get(this.url+'/patients')

  }



  addPatient(Patient_add:Patient): Observable<any> {

    let body = JSON.stringify(Patient_add);
    return this.http.post(this.url+'/patients', body)
 }


  deletePatient(patient:Patient): Observable<any>{
    let body=JSON.stringify(patient);
    return this.http.delete(this.url+'/patients/'+body);

  }


  editPatient(item:Patient) : Observable<any> {

    let body = JSON.stringify(item);
    return this.http.post('http://localhost:8080/patients/'+item, body)


  }


  }

#view/delete.ts

deletePatient(id:Patient){

    this.databasedata.deletePatient(id).subscribe(

      (data:any)=>{

        if(data.affectedRows==1){
           let mes=this._toast.create({
            message:'Task Deleted Successfully',
            duration:2000,
            position:'bottom'
          });

          this.AllPatient.splice(this.AllPatient.indexOf(id),1);
          mes.present();
        }

        else{
          let mes=this._toast.create({
            message:'Error in deleting task',
            duration:2000,
            position:'bottom'
          });
          mes.present();
        }
      }
  ,)}

0 个答案:

没有答案