The problem with using JSP for generating XML is that the JSP wants to
assume that it is sitting at the top level of your application, i.e. it
wants to send the response back to the client.
>From what I understand, your current architecture looks like this
[db] <-----> [pl/sql] ---XML---> [XSL engine] --HTML via HTTP---> [client]
If we try to introduce JSP into this scenario we get
[db] <-----> [pl/sql] ---data---> [JSP] ---XML via HTTP--> [client]
There is no room after the JSP layer to perform the XSL transformation
JSP does not allow for post processing of it's output in order to perform
the rendering. I believe this is because JSP is meant to be used in as
presentation generation language, not as a data mapping language. Sure, you
could chain this to another servlet which contained your rendering code, but
it is much cleaner to just have something like
[db] <-----> [pl/sql] ---data---> [XML data mapping code] ---XML--> [XSL
engine] --XML/PDF/etc. via HTTP--> [client]
It is the requirement that JSP respond to the client that limits its
usefulness in this context.
--shawn
----- Original Message -----
From: Daniel Lopez <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 18, 2000 1:32 AM
Subject: Re: JSPs and XML.
> Hi Shawn,
>
> We are doing something very similar, and we might as well use JSP later
> down the road so I'll get you my own reasoning.
> Why? Because that way you have the data generated by your action
> completely independent of the way you present the data. So independent
> that you don't have to use Java to format this data or even produce it.
> For example, right now we skipped the JSP part because we are generating
> the XML directly from PL/SQL but if we have to add some operations that
> will be done better in Java (handling files...) we just need to produce
> XML from Java and use the same XSLT sheets as the PL/SQL operations. Our
> grahical designer won't even know if we are performing the logic in
> PL/SQL or Java. And you might ask then why use JSP instead of generating
> XML directly from servlets. Well, for the same reason we generate HTML
> through JSP instead of generating it directly from servlets, to make the
> result independent of the classes that implement it, easier to produce
> without getting into the code...
> Another reason why one would want to generate XML from JSP would be to
> be able to forward this result to diferent XSLT and produce WML, HTML,
> ... using the same functionality but with diferent XSLT.
> I understand that one might think, why add such an overhead... Again,
> JSPs are supposed not to be such an overhead because they are compiled
> into servlets the first time you access them (you might even precompile
> them sometimes) so they are more like a different way of specifying your
> output.
>
> So, IMHO, if you are just producing HTML, you are just performing your
> operations in Java and you don't have a designer that can play XSLT,
> then there's no need to go for XML. But if you want to produce different
> ouput formats reusing the same functionality, you need to seamlesly
> integrate different sources of the information into your HTML layer or
> you have a designer that can play XSLT then you can get some advantages
> by using XML and you might want to produce it from Java through JSP.
>
> Just my 2ec
> Dan
> -------------------------------------------
> Daniel Lopez Janariz ([EMAIL PROTECTED])
> Web Services
> Computer Center
> Balearic Islands University
> -------------------------------------------
>
>
> Shawn McKisson wrote:
> >
> > Why would you want to take data, convert it into another form of data
and
> > *then* convert it into HTML?
> >
> > This is like pouring yourself a cold beer by first pouring it from the
> > bottle into one mug, then pouring that mug into another mug.
> >
> > If a you have a JSP page which does emit XML, you could chain the output
of
> > that page through another servlet which performed the XML/XSL
conversion. So
> > the XML/XSL servlet would use the JSP page as a data source.
> >
> > There were some really good articles about 7-12 months ago on
XML-INTEREST
> > about this.
> > If I can find them I will mail them to you.
> >
> > --shawn
> >
> > ----- Original Message -----
> > From: Robert Nicholson <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, May 17, 2000 5:10 AM
> > Subject: Re: JSPs and XML.
> >
> > > I would like to know if a JSP app emits XML what component of existing
> > > application servers can translate that to whatever presentation
language
> > is
> > > prefered? I want to understand how XSLT fits into a JSP app's
> > architecture.
> > >
> > > ----- Original Message -----
> > > From: "Shawn McKisson" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Tuesday, May 16, 2000 9:15 PM
> > > Subject: Re: JSPs and XML.
> > >
> > >
> > > > Just return XML tags instead of only HTML tags.
> > > > There is nothing special that needs to be done.
> > > >
> > > > If you are going to just turn around and reprocess the XML into HTML
> > using
> > > > something like XSL, then you are basically needlessly supporting two
> > > > presentation layers. You should reconsider your app architecture.
> > > >
> > > > --shawn
> > > >
> > > > ----- Original Message -----
> > > > From: Bilal Ali Nawaz <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Tuesday, May 16, 2000 1:36 AM
> > > > Subject: JSPs and XML.
> > > >
> > > >
> > > > > hi all,
> > > > > can anyone please direct me to some useful resources on the web
> > > concerning
> > > > how
> > > > > to output XML through a JSP? basically what i want to study is
that
> > can
> > > > XML be
> > > > > 'thrown' by a jsp just like HTML? and if so, how??
> > > > >
> > > > > thanking all of you in advance,
> > > > > bilal.
> > > > >
> > >
_________________________________________________________________________
> > > > >
> > > > > Disclaimer:
> > > > >
> > > > > "This message is confidential. It may also be privileged or
otherwise
> > > > protected
> > > > > by legal rules. If you have received it by mistake please let us
> > know
> > > by
> > > > reply
> > > > > and then delete it from your system."
> > > > >
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets