public String addMessage() throws UnsupportedEncodingException{ Patient patient=new Patient(); patient.setMACHINE_CODE(machine_code); patient.setPATIENT_NAME(name); patient.setPATIENT_GENDER(gender); patient.setPATIENT_AGE(age); patient.setPATIENT_BIRTHDAY(birth); patient.setPATIENT_BMI(BMI); patient.setPATIENT_HEIGHT(height); patient.setPATIENT_WEIGHT(weight); patient.setPATIENT_PASSWORD(phoneNumber); patient.setPATIENT_EMAIL(email); patient.setPATIENT_LOCATION(location); int flag= illerappService.addMessage(patient); return SUCCESS; } get set方法省略
前台传过来的数据数字和英文 都没问题,就是传过来gender中文出现乱码现象。
改成: String _gender = new String(gender.getBytes("ISO-8859-1"),"utf-8");
patient.setPATIENT_GENDER(_gender);