2010-12-21 7 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"); 
    } 

} 

sucessfully示したページの一つで、アドレスバーにビューのURLを表示、が、URLが変更をdosn't、URLがアドレスwww.url.com/patient1/patientDetail.htmではなく、アクション

を示していないことを意味し私は戻ってビューのアドレスもURLに表示する必要がありますしたい。

私は

答えて

1

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

それとも

redirect:patient1/patientDetail 
のいずれかを使用して助けてください
関連する問題