public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    PrintWriter out = response.getWriter();

    response.setContentType("text/html");

    int codigoTipoDoenca = Integer.parseInt(request.getParameter("codTipoDoenca"));

    IManager mgr = ComponentFactory.createInstance();
    IHTMLPageMgt htmlPageMgt = (IHTMLPageMgt) mgr.getRequiredInterface("IHTMLPageMgt");
    try {

      IQueryInfoMgt query = (IQueryInfoMgt) mgr.getRequiredInterface("IQueryInfoMgt");
      IDiseaseDt tp = query.searchDiseaseType(codigoTipoDoenca);

      out.println(htmlPageMgt.open("Queries - Diseases"));
      out.println("<body><h1>Querie result<br>Disease</h1>");

      out.println("<P><h3>Name: " + tp.getName() + "</h3></P>");
      out.println("<P>Description: " + tp.getDescription() + "</P>");
      out.println("<P>How manifests: " + tp.getManifestation() + " </P>");
      out.println("<P>Duration: " + tp.getDuration() + " </P>");
      out.println("<P>Symptoms: </P>");

      Iterator i = tp.getSymptoms().iterator();

      if (!i.hasNext()) {
        out.println("<P>There isn't registered symptoms.</P>");
      } else {
        while (i.hasNext()) {
          ISymptomDt s = (ISymptomDt) i.next();
          out.println("<li> " + s.getDescription() + " </li>");
        }
      }
      out.println(htmlPageMgt.closeQueries());
    } catch (ObjectNotFoundException e) {
      out.println("<P> " + e.getMessage() + " </P>");
    } catch (Exception e) {
      out.println(htmlPageMgt.errorPage("Comunitation error, please try again later."));
      e.printStackTrace(out);
    } finally {
      out.close();
    }
  }
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    PrintWriter out = response.getWriter();

    response.setContentType("text/html");

    int codigoEsp = Integer.parseInt(request.getParameter("codEspecialidade"));

    IManager mgr = ComponentFactory.createInstance();
    IHTMLPageMgt htmlPageMgt = (IHTMLPageMgt) mgr.getRequiredInterface("IHTMLPageMgt");
    try {

      IQueryInfoMgt query = (IQueryInfoMgt) mgr.getRequiredInterface("IQueryInfoMgt");
      IteratorDsk repUS = query.searchHealthUnitsBySpeciality(codigoEsp);

      out.println(htmlPageMgt.open("Queries - Health Unit"));
      out.println("<body><h1>Querie result<br>Health units</h1>");

      out.println("<P><h3>Medical specialty: " + codigoEsp + "</h3></P>");
      out.println("<h3>Health units:</h3>");

      if (repUS != null) {
        while (repUS.hasNext()) {
          IHealthUnitDt us = (IHealthUnitDt) repUS.next();
          out.println("<dd><dd>" + us.getDescription());
        }
      }

      out.println(htmlPageMgt.closeQueries());
    } catch (ObjectNotFoundException e) {
      out.println("<P> " + e.getMessage() + " </P>");
    } catch (Exception e) {
      out.println(htmlPageMgt.errorPage("Comunitation error, please try again later."));
      e.printStackTrace(out);
    } finally {
      out.close();
    }
  }