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

JSPs as XML documents, but no HTML rendered!

Adrian Enns
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
I am using Tomcat 5.5 and trying to run a simple JSP using the XML syntax. When I call the JSP page no error occurs, but the output of the page appears as XML in the browser... whereas I really want it to render HTML. Do I need to do something to make the page render HTML? The code for my page is below:

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:text>
<html>
<head><title>Simple JSP as XML</title></head>
<body>
<h1>Hello World!</h1>
</body>
</html>
</jsp:text>
</jsp:root>
[ May 11, 2005: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60055
    
  65

trying to run a simple JSP using the XML syntax


Why? The XML syntax (termed "JSP Documents") isn't well suited to hand-coding but is intended for machine-generated pages.

That said, your container is obviously not recognizing the page as JSP and is sending it uninterpreted to the browser.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Adrian Enns
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
I figured it out. Had to use the following directive to explicitly state that the page should be rendered as HTML:

<jsp irective.page contentType="text/html"/>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSPs as XML documents, but no HTML rendered!
 
Similar Threads
Problem using EL function from taglib defined using jsp:root tag
dont want a JSP page appear as XML
wanted to create own tag in struts using NetBeans and use it in .jspx file
XML VIEW OF JSP PAGE:
jsp page appears in xml tree format. how can i fix this?