Buggy code:
public class IpdServlet extends HttpServlet { private static final long serialVersionUID = 1L ; PatientDAO patientDAO = new PatientDAO ( ) ; DoctorDAO doctorDAO = new DoctorDAO ( ) ; WardDAO wardDAO = new WardDAO ( ) ; AdmissionTypeDAO admissionTypeDAO = new AdmissionTypeDAO ( ) ; IpdDAO ipdDAO = new IpdDAO ( ) ; public IpdServlet ( ) { } protected void doGet ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } protected void doPost ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { String msg = "" ; String btnclick = request . getParameter ( "action" ) ; if ( "add" . equalsIgnoreCase ( btnclick ) ) { Integer patientId = MyObject . stringToInt ( request . getParameter ( "patientId" ) ) ; if ( patientId != null ) { Patient patient = patientDAO . findById ( patientId ) ; Integer doctorId = MyObject . stringToInt ( request . getParameter ( "doctorId" ) ) ; Doctor doctor = doctorDAO . findById ( doctorId ) ; Integer admissionTypeId = MyObject . stringToInt ( request . getParameter ( "admissionTypeId" ) ) ; AdmissionType admissionType = admissionTypeDAO . findById ( admissionTypeId ) ; String staffName = request . getParameter ( "staffName" ) . trim ( ) ; String admissionId = request . getParameter ( "admissionId" ) . trim ( ) ; Date entryDate = DateTimeUtil . ParseString ( request . getParameter ( "entryDate" ) ) ; Date admissionDate = DateTimeUtil . ParseString ( request . getParameter ( "admissionDate" ) ) ; String admissionTime = request . getParameter ( "admissionTime" ) . trim ( ) ; String ward = request . getParameter ( "ward" ) . trim ( ) ; Integer bedNo = MyObject . stringToInt ( request . getParameter ( "bedNo" ) ) ; String admissionDiagnosis = request . getParameter ( "admissionDiagnosis" ) . trim ( ) ; String admissionDetail = request . getParameter ( "admissionDetail" ) . trim ( ) ; String admissionTreatment = request . getParameter ( "admissionTreatment" ) . trim ( ) ; String allergyDetail = request . getParameter ( "allergyDetail" ) . trim ( ) ; String specialNote = request . getParameter ( "specialNote" ) . trim ( ) ; Double advancePayment = MyObject . stringToDouble ( request . getParameter ( "advancePayment" ) ) ; String remark = request . getParameter ( "remark" ) . trim ( ) ; Ipd ipd = new Ipd ( ) ; ipd . setPatient ( patient ) ; ipd . setDoctor ( doctor ) ; ipd . setAdmissionType ( admissionType ) ; ipd . setStaffName ( staffName ) ; ipd . setAdmissionId ( admissionId ) ; ipd . setEntryDate ( entryDate ) ; ipd . setAdmissionDate ( admissionDate ) ; ipd . setAdmissionTime ( admissionTime ) ; ipd . setWard ( ward ) ; ipd . setBedNo ( bedNo ) ; ipd . setAdmissionDiagnosis ( admissionDiagnosis ) ; ipd . setAdmissionDetail ( admissionDetail ) ; ipd . setAdmissionTreatment ( admissionTreatment ) ; ipd . setAllergyDetail ( allergyDetail ) ; ipd . setSpecialNote ( specialNote ) ; ipd . setAdvancePayment ( advancePayment ) ; ipd . setRemark ( remark ) ; IpdDAO ipdDAO = new IpdDAO ( ) ; ipdDAO . add ( ipd ) ; } else { msg = "Please<seq2seq4repair_space>load<seq2seq4repair_space>data<seq2seq4repair_space>for<seq2seq4repair_space>admission<seq2seq4repair_space>in<seq2seq4repair_space>IPD" ; } } else if ( "load" . equalsIgnoreCase ( btnclick ) ) { OpdDAO opdDAO = new OpdDAO ( ) ; String admissionId = request . getParameter ( "admissionId" ) . trim ( ) ; Opd opd = opdDAO . findByAdmissionId ( admissionId ) ; if ( opd != null ) { request . setAttribute ( "opd" , opd ) ; } else { msg = "Invalid<seq2seq4repair_space>Admission<seq2seq4repair_space>No" ; } loadData ( request ) ; request . setAttribute ( "msg" , msg ) ; <START_BUG> request . getRequestDispatcher ( "//pages//opdAdd.jsp" ) . forward ( request , response ) ; <END_BUG> return ; } else if ( "update" . equalsIgnoreCase ( btnclick ) ) { Integer id = Integer . parseInt ( request . getParameter ( "id" ) ) ; Doctor doctor = new Doctor ( ) ; Integer doctor_id = MyObject . stringToInt ( request . getParameter ( "doctorId" ) ) ; doctor = doctorDAO . findById ( doctor_id ) ; Double consulationFee = MyObject . stringToDouble ( request . getParameter ( "consulationFee" ) ) ; OpdDAO opdDAO = new OpdDAO ( ) ; Opd opd = opdDAO . findById ( id ) ; opd . setConsulationFee ( consulationFee ) ; opd . setDoctor ( doctor ) ; opdDAO . update ( opd ) ; request . setAttribute ( "msg" , "Opd<seq2seq4repair_space>updated<seq2seq4repair_space>successfull" ) ; } request . setAttribute ( "msg" , msg ) ; request . getRequestDispatcher ( "//pages//ipd.jsp" ) . forward ( request , response ) ; } private void loadData ( HttpServletRequest request ) { } }

Fix:
request . getRequestDispatcher ( "//pages//ipdAdd.jsp" ) . forward ( request , response ) ;