public ActionForward fetchEscalationLevel( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { EscalationDao escalationDaoImpl = new EscalationDaoImpl(); EscalationForm escalationForm = (EscalationForm) form; EscalationDTO escalationDTO = new EscalationDTO(); String escalation_level_status = null; Document document = DocumentHelper.createDocument(); Element root = document.addElement("options"); Element optionElement, hiddenElement; try { String escalation_type = escalationForm.getEscalation_type(); String workflow_step_id = escalationForm.getWorkflow_step_id(); System.out.println("escalation_type---->" + escalation_type); System.out.println("workflow_step_id---->" + workflow_step_id); if (escalation_type != null && workflow_step_id != null) { populate(form, request); List escalation_level_list = escalationDaoImpl.getEscalation_Level(escalation_type, workflow_step_id); if (escalation_level_list != null && escalation_level_list.size() > 0) { escalationForm.setEscalation_level_list(escalation_level_list); for (int intCounter = 0; intCounter < escalation_level_list.size(); intCounter++) { optionElement = root.addElement("option"); optionElement.addAttribute( "value", ((EscalationDTO) escalation_level_list.get(intCounter)).getEscalation_level()); optionElement.addAttribute( "text", ((EscalationDTO) escalation_level_list.get(intCounter)).getEscalation_level()); hiddenElement = root.addElement("hidden"); hiddenElement.addAttribute( "status", ((EscalationDTO) escalation_level_list.get(intCounter)) .getEscalation_level_status()); } } response.setContentType("text/xml"); response.setHeader("Cache-Control", "No-Cache"); PrintWriter out = response.getWriter(); XMLWriter writer = new XMLWriter(out); writer.write(document); logger.info("document : \n\n" + document.asXML()); writer.flush(); out.flush(); } } catch (Exception exception) { exception.printStackTrace(); } return null; }