• Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp written in xml

 
Edward Brode
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I was wondering if anyone else had tried this. Marty Hall mentions in his first book (I don't have the second one yet since it is $60 in the UK: �39) that each of the commonly used versions of jsp notation such as:
<%= class.getSomethingInteresting();%>
has an xml version of it that is a tag such as: <jsp:expression>class.getSomethingInteresting();</jsp:expression
Since *everything* seems to be heading in the direction of xml, it seemed like producing jsp pages as well-formed xml documents would be a good idea, so I thought I would try to write a jsp page entirely using this notation. It took quite a while just to find the namespace to use, the result looks like this:
<?xml version="1.0"?>
<!-- coffees_xml.jsp -->
<jsp:root xmlns:jsp="http://java.sun.com/products/jsp/dtd/jsp_1_0.dtd">
<jsp:directive.page content="text/html"/>
<jsp:scriptlet>
out.write("<html><title>Cafe Java</title><head></head><body><h1>Welcome to Cafe Java!</h1><h2>Available Coffees:</h2><table><tr><th>Coffee</th><th>Price</th></tr>");
out.write("<tr><td>Real Coffee"></td><td>Very Expensive</td></tr>");
out.write("<tr><td>Instant Coffee"></td><td>Very Cheap</td></tr>");
out.write("</table></body></html>");
</jsp:scriptlet>
</jsp:root>
The parser for Tomcat 4.0 (Jasper, I think) doesn't seem to be able to deal with it, though. It begins writing the code itself to the output instead of just the html.
I've had a look in at the JSPTL stuff at Sun, but outside than the tag libraries themselves they are still using the usual notation. Is this a waste of time or do I have the wrong dtd. For that matter where can you find a list of dtds at Sun? I found this one while browsing one of Wrox's sometimes good P2P series books, the name of which I can't remember.
Regards,
[ May 20, 2002: Message edited by: Edward Brode ]
 
ersin eser
Ranch Hand
Posts: 1072
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is Carl's notes from the newsletter
http://www.javaranch.com/newsletter/Feb2002/newsletterfeb2002.jsp#feature
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Edward Brode:
out.write("<tr><td>Real Coffee"></td><td>Very Expensive</td></tr>");
out.write("<tr><td>Instant Coffee"></td><td>Very Cheap</td></tr>");

these two lines have an extra " could that be the problem?
[ May 20, 2002: Message edited by: Jessica Sant ]
 
Edward Brode
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well spotted, Jessica, but no cigar on that one. The content of the newsletter that ersin pointed me toward was what I needed. Many thanks to you both. There's quite a contrast in the level of helpfulness one receives here compared to the "mainstream" java groups.
Thanks again,
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Edward Brode:
Many thanks to you both. There's quite a contrast in the level of helpfulness one receives here compared to the "mainstream" java groups.

Thanks!! Glad we could help out -- I'm sure you'll find it as helpful here as many of us have.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!