This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

jsp written in xml

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 1072
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is Carl's notes from the newsletter
http://www.javaranch.com/newsletter/Feb2002/newsletterfeb2002.jsp#feature
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic