5 Replies Latest reply on Aug 5, 2009 8:42 AM by roshni79

    Better method to get XML serialized data from JSP?

    roshni79 Level 1

      Hello all,

       

      In my flex project, I am using JSP/servlet code to get data from a mySQL database. The servlet code outputs XML serialized data as response. I am using PrintWriter.write() method to format the response in xml format. Is this the right method of doing this? Can I get resultset from mySQL database in XML form?

       

      res.setContentType("text/xml");
      PrintWriter out = res.getWriter();

      ..............................
      ..............................

      out.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
      out.write("<LoginStatusMessage>");
                     
      if(rs.getInt(1) != 0)
      {
          out.write("success");
      }
      else{
          out.write("failure");
      }
                     
      out.write("</LoginStatusMessage>");

       

      Thanks.
      roshni