Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

JSPs as XML documents, but no HTML rendered!

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Marshal
Posts: 67387
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Adrian Enns
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"/>
 
Don't play dumb with me! But you can try this tiny ad:
ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/730700/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic