Shawn,

There are at least 2 method through which you can post-process the XML
generated in a JSP page. One is the approach that Joseph uses,
post-processing based in the mime-type of the answer. However, this
approach is container specific and we prefer to use the second one,
which is nothing less than using a JSP taglib that encloses your whole
JSP and postprocess everything in the doEndTag() method. You just need a
JSP1.1 compatible container and the actual taglib class is very simple.
I have tested it and it works, we are just not using it now because
PL/SQL is good enough for what we want to do. If we needed to process
some files/ access the filesystem, then I'd introduce JSPs in the mix.
I hope this helps,
Dan
-------------------------------------------
Daniel Lopez Janariz ([EMAIL PROTECTED])
Web Services
Computer Center
Balearic Islands University
-------------------------------------------

"Joseph B. Ottinger" wrote:
>
> On Thu, 18 May 2000, Shawn McKisson wrote:
>
> Coimments are interspersed.
>
> > 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.
>
> It does? Funny, I use JSP to generate XML all the time, and it goes
> through XSL on the server...
>
> > >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.
>
> Um, maybe you should switch to a better app server, one that allows
> chaining based on mime types. As stated, I use a design something like
> this:
>
> [db] --data--> [beans] --> jsp --XML+XSL--> HTML
>
> The XSL can be active content itself, so the HTML is variable (I just
> haven't used it for anything else.
>
> BTW, example content can be found at http://www.orionsupport.com/ - don't
> let the file extensions fool you, it's all JSP, XML, XSL.
>
> > --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."
> > > > > > >
> > >
> > >
> > > -----------------------------------------------------------
> Joseph B. Ottinger               [EMAIL PROTECTED]
> http://cupid.suninternet.com/~joeo      HOMES.COM Developer
>

===========================================================================
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

Reply via email to