Announcement Announcement Module
Collapse
No announcement yet.
Need help to display XML to a URL Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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?

  • #2
    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;

    Comment

    Working...
    X