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 ]