> -----Original Message----- > From: Gupta, Sahil [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 19, 2004 1:42 PM > To: 'Struts Users Mailing List' > Subject: Returning xml stream from struts > > > Hi, > > I have an application written in struts and i want to return > xml in the > response to the request. The request is being made from a > client which makes > http connection to my servlet and posts the request to it. I > was wondering > whats the best way to send the response back. > > Option: > Setting the content type of the response header to text/html > and sending the > xml in the response. My Question then is: > How do i put the xml string in the response body? > > Any Ideas.
Yes.... first start with a large wooden rabbit.. sorry.. wrong thread... The brute force and ignorant way: response.getOutputStream().print( "your xml goes here"); Slightly less brute force: response.getOutputStream().print( myXmlObject.toString()); If your xml is mostly boilerplate, then you could use velocity as a templating mechanism. Your xml file coud end in jsp, and otherwise be a legal xml file, allowign you to use JSTL/struts tags to actually build the file. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]