Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML & JSP Technology

 
Satya Srini
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know how to send the results back from the JSP in form of an XML document.
srini
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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" %>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic