The Artima Developer Community
Sponsored Link

Java Buzz Forum
JSPX for XML

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Russell Beattie

Posts: 727
Nickname: rbeattie
Registered: Aug, 2003

Russell Beattie is a Mobile Internet Developer
JSPX for XML Posted: Dec 19, 2003 11:23 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Russell Beattie.
Original Post: JSPX for XML
Feed Title: Russell Beattie Notebook
Feed URL: http://www.russellbeattie.com/notebook/rss.jsp?q=java,code,mobile
Feed Description: My online notebook with thoughts, comments, links and more.
Latest Java Buzz Posts
Latest Java Buzz Posts by Russell Beattie
Latest Posts From Russell Beattie Notebook

Advertisement
Tomcat 5 is actually sucking a lot less than I thought it would. I still need to see its performance, but with built in db-pooling, admin screen and all the neat new features of JSP 2.0, I'm warming up to it.

Last night I was going through the examples - I still don't grok JSP Fragments - and discovered this:

JSPX - XHTML Basic Example

This example illustrates how to use JSPX to produce an XHTML basic document suitable for use with mobile phones, televisions, PDAs, vending machines, pagers, car navigation systems, mobile game machines, digital book readers, smart watches, etc.

JSPX lets you create dynamic documents in a pure XML syntax compatible with existing XML tools. The XML syntax in JSP 1.2 was awkward and required <jsp:root> to be the root element of the document. This is no longer the case in JSP 2.0.

This particular example uses a tag file to produce the DOCTYPE and namespace declarations to make the output of this page a valid XHTML Basic document.

It's very interesting. Like it said, the old JSPX wasn't something I would've ever wnated to play with. I'm pretty sure it was a version of JSP meant for automatic generation, not human readable. But with the .tag file creating the structure the JSPX sets the header and MIME type for you, which is very cool. Because of the way the java code is generated in JSP, if you put the XML header just in plain text, it won't work because Jasper and other JSP parsers will put a newline in front of it, which XML processors don't like. So I've had to work around that by putting something like this on top of all my JSP pages to get "real" XML:

<% out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); %>

I'll have to play with it, but JSPX's might be perfect for producing XHTML pages, exactly as the example said. I need to get something working to see the results in real life...

-Russ

Comment

Read: JSPX for XML

Topic: Rivals IBM and BEA team on new Java Appserver specs Previous Topic   Next Topic Topic: Rant n/t

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use