2010-12-21 2 views
0
@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"); 
    } 

} 

성공적 도시 된 페이지를 하나의 주소창에 뷰의 URL을 표시하지만, URL이 변경 dosn't, URL이 주소 www.url.com/patient1/patientDetail.htm대신 작업

을 도시되지 않은 수단 그리고 나는 다시보기 주소가 또한 URL에 표시되어야합니다.

나에게 도움을 주시기 바랍니다

답변

1

사용 중

new ModelAndView(new RedirectView(patient1/patientDetail)). 

또는

redirect:patient1/patientDetail