Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP HTML to XML conversion  RSS feed

 
Kevin Wong
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I am still having problems with converting the output from the jsp default html to xml.
Not sure why the jsp is not responding in xml.
<html>
<head>
<title>My REST Service</title>
</head>
<body>
<%
response.setContentType("text/xml");
out.println("<test><test1>The result is 9003888</test1></test>");
%>
</body>
</html>

Thanks in advance
Kevin
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36406
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your page is returning HTML. I can tell because it has <html> in it. If you remove the HTML before and after your XML, you will really have an XML file.

Also note that the following two lines are identical in a JSP:
out.println("<test><test1>The result is 9003888</test1></test>");
<test><test1>The result is 9003888</test1></test>
 
Bauke Scholtz
Ranch Hand
Posts: 2458
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!