Results 1 to 2 of 2

Thread: Need help to display XML to a URL

  1. #1
    Join Date
    Feb 2007
    Location
    Saint Louis
    Posts
    86

    Default Need help to display XML to a URL

    I have an XML String that I want to print out to a URL. I've tired using the PrintWriter function that was used previously but this is inside of the method @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request,
    HttpServletResponse response) throws Exception

    which requires a ModelAndView or (null) be returned. If you return null it of course will not show anything but I'm unclear on how to just return this string of XML that I need displayed to a URL (i.e. - http://localhost:8080/service). Since this method needs to return something the PrintWriter won't work. Any ideas on what I can do with the XML string I have to print this to the screen?
    Andrew W. McDougall

  2. #2
    Join Date
    Jan 2007
    Location
    Orlando, FL USA
    Posts
    84

    Default

    Hi Macdoug1,

    Returing null with handleRequestInternal() means you going to build the result on your own. Try something like this inside your method:
    Code:
    		response.setContentType("text/xml");
    		PrintWriter writer = response.getWriter();
    		writer.println("<data>stuff</data>");
    		return null;
    http://www.jroller.com/thebugslayer - notes on java, scala and other development stuff.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •