@RequestMapping(value = "updatePatient", method = RequestMethod.POST)
public ModelAndView postUpdatePatientById(
@ModelAttribute("patient") PatientForm patientForm,
HttpSession session) {
Long id = (Long) session.getAttribute("refId");
if (id != 0 || id != null) {
Patient patient1 = HospitalPatientHelper
.getPatientFrom_PatientForm(patientForm);
patientService.updatePatient(patient1, id);
PatientService patientService) {
Patient patient = patientService.getPatientById(id);
ModelAndView mv;
PatientForm patientForm = HospitalPatientHelper
.getPatientForm_FromPatient(patient);
List<Weight> weights = patientService.viewLast10RecordedWeight(patient);
WeightTable weightTable = new WeightTable();
List<WeightSummaryTable> summaryWeights = weightTable.summary(weights,
patient.getHeight());
mv = new ModelAndView("patient1/patientDetail");
mv.addObject("patient", patientForm);
mv.addObject("summaries", summaryWeights);
mv.addObject("lastWeight", summaryWeights.get(0).getWeight());
mv.addObject("bmi", summaryWeights.get(0).getBmi());
return mv;
} else {
return new ModelAndView("patient1/patientDetail");
}
}
页面显示成功,但网址不会更改,表示网址未显示地址www.url.com/patient1/patientDetail.htm
我希望返回的视图地址也应该显示在网址中。
请帮帮我
答案 0 :(得分:1)
使用
new ModelAndView(new RedirectView(patient1/patientDetail)).
或
redirect:patient1/patientDetail