File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes XML & JSP Technology Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "XML & JSP Technology" Watch "XML & JSP Technology" New topic
Author

XML & JSP Technology

Satya Srini
Greenhorn

Joined: Feb 27, 2001
Posts: 4
Does anyone know how to send the results back from the JSP in form of an XML document.
srini


srini
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
A JSP page can be written entirely as XML - after all there is little difference between HTML and XML formatting.
So just do it.
------------------
author of:
Scott Stirling
Greenhorn

Joined: Mar 05, 2001
Posts: 24
The form of a JSP can be pure XML because the JSP spec specifies a standard translation of JSP syntax to XML (good if your JSP container supports it), but the output of a JSP is completely separate. I.e., a JSP can ouput plain text, HTML, XHTML, an applet, more XML, etc. I think the user is asking about outputting XML from JSP, not authoring JSPs in XML.
To get XML output, make sure you format any static template data in the JSP as well-formed XML. Then at the top of the JSP set the MIME type as XML, for example (using the default charset):
<%@ page contentType="text/xml;charset=ISO-8859-1" %>


Scott Stirling<BR>Author of <A HREF="http://www.amazon.com/exec/obidos/ASIN/067231939X/ref=ase_electricporkchop/107-2476442-4883722" TARGET=_blank rel="nofollow">Java Server Pages Application Development</A>
 
Don't get me started about those stupid light bulbs.
 
subject: XML & JSP Technology
 
Similar Threads
Well Formed
browser returning error
How can I set bean property in JSF page?!
parse xml
jsp always an xml